Cos3721 Assignment 3 2023
COS3721 A3 - Good marks guaranteed Operating Systems And Architecture (University of South Africa) lOMoARcPSD| COS3721 Assignment 3 2022 Unique No.: Due Date: 19 September 2022 lOMoARcPSD| Preview … Question 1 a) Probability of 1 failure of 1000 hard disk = 750,000/1000 = 750 hrs So, 750/24 = 31.25 days So answer is approx. one in a month. b) 1 million hours is approximately 114 years, but we cannot say that warranty of product is 114 years, MBTF is a experiment and statistical approach to find the mean time between the failures But we can find using below formula what is the probability of product performing of certain years without failure R(t) = e –t/mtbf therefore probabilities for lasting years are given below 1 year %R(1) = 100 * e –8760hrs /1 million = 99.12 similarly for 2 years 98.26% 3 years 97.40% and so on.. Downloaded by Genial Adventures () lOMoARcPSD| Question 1 a) Probability of 1 failure of 1000 hard disk = 750,000/1000 = 750 hrs So, 750/24 = 31.25 days So answer is approx. one in a month. b) 1 million hours is approximately 114 years, but we cannot say that warranty of product is 114 years, MBTF is a experiment and statistical approach to find the mean time between the failures But we can find using below formula what is the probability of product performing of certain years without failure R(t) = e –t/mtbf therefore probabilities for lasting years are given below 1 year %R(1) = 100 * e –8760hrs /1 million = 99.12 similarly for 2 years 98.26% 3 years 97.40% and so on.. Downloaded by Genial Adventures () lOMoARcPSD| Question 2 2.1. Downloaded by Genial Adventures () lOMoARcPSD| 2.2. #include iostream #include queue #include stdlib.h using namespace std; //structure for a timer request struct TimerRequest { int processID; //process ID int time; //time //comparison operator for priority queue bool operator()(const TimerRequest& t1, const TimerRequest& t2) { return ; } }; //virtual clock class class VirtualClock { private: priority_queueTimerRequest, vectorTimerRequest, TimerRequest timerQueue; //priority queue of timer requests public: //constructor VirtualClock() { } //add a timer request to the queue void addTimerRequest(int processID, int time) { TimerRequest temp; ssID = processID; = time; timerQ(temp); } //get the next timer request from the queue TimerRequest getNextTimerRequest() { TimerRequest temp = timerQ(); timerQ(); return temp; } //check if the queue is empty bool isEmpty() { return timerQ(); } }; int main() { //create a virtual clock lOMoARcPSD| VirtualClock vc; //add some timer requests TimerRequest(1, 10); TimerRequest(2, 5); TimerRequest(3, 15); //get and print the next timer request TimerRequest tr = NextTimerRequest(); cout"Process ID: "ssID", Time: "endl; //get and print the next timer request tr = NextTimerRequest(); cout"Process ID: "ssID", Time: "endl; //get and print the next timer request tr = NextTimerRequest(); cout"Process ID: "ssID", Time: "endl; //check if the queue is empty if(Empty()) cout"Queue is empty"endl; else cout"Queue is not empty"endl; system("pause"); return 0; } Explanation: • A timer that is implemented in software and serves the purpose of keeping track of the passage of time within a computer system is referred to as a virtual clock. The processes and applications currently executing on the system generate timer requests, and the virtual clock is responsible for storing these requests in a queue and managing them. The correct and effective management of time within the system is ensured by the utilization of the virtual clock in this manner. • In most cases, the hardware of a computer system has access to three different timer channels. The virtual clock makes use of these channels in order to queue and otherwise manage timer request messages. The timer requests are kept in the virtual clock's priority queue, which sorts the requests based on the times they were sent. As a result, the requests for the timer will be processed in the appropriate sequence. • When a timer request is made, the process or application that makes the request sends the time at which the request should be processed to the virtual clock. This ensures that the request is dealt with at the appropriate moment. The request is placed in a queue by the virtual clock, which then manages it based on the time that was provided. The virtual clock works in this way to ensure that timer requests are processed accurately and in a timely manner. • A computer's virtual clock is an essential component because it ensures that time is handled in an accurate and effective manner across the entire system. Without a virtual clock, processes and applications would be unable to make appropriate use of timers, which would result in the system as a whole being unable to operate in an appropriate manner.
Información del documento
- Subido en
- 8 de febrero de 2023
- Número de páginas
- 11
- Escrito en
- 2022/2023
- Tipo
- Examen
- Contiene
- Preguntas y respuestas