Operating System Assignment
Concordia UniversityOperating SystemsTheory Assignment#1 Question 1P1 = 15 + 10 +10P1 = 35 units of timeP2 = 10 + 5 + 15P2 = 30 units of timeWith a single programmed operating system:Ptot = P1 + P2Ptot = 35 + 30Ptot = 65 units of time[pic 1]With a multiprogrammed operating system, we don’t have I/O burst time:Ptot = (15 + 10) + (10 + 15)Ptot = 50 units of time[pic 2]With a single programmed operating system, Troughput = 2/65And with a multiprogrammed operating system, Troughput = 2/50Question 2To complete the load of N processes in a small time, we have to execute all the process at the same time and have a multiprogrammed OS with a capacity n.With a single programmed OS and interruptions, the time to complete the load of N process is going to be to be longer than the addition time because processes can’t be executed at the same time and interruptions take times.Question 3[pic 3]Question 4Context switch need to be atomic otherwise it can be interrupted by other processes and if context switch is interrupted before saving the block for a restoration, it will lose data.Question 5The user threads share data with all other threads inside the process while kernel threads are threads which are fully executed in kernel mode, and there is no user mode in it.Question 6This solution satisfies mutual exclusion of the critical section because it has flags and turn variable. In the case of both processes set their flag to TRUE, only the process whose turn will succeed. After, the process which is waiting will enter in the critical section when and only when the other will update the value of turn.This solution satisfies the “progress” requirement also because it has flags and turn variable. When a process wants to access to critical section, it set their flag variable to TRUE and enter. The other process’s value is set to turn, exiting its critical section. If the other process wants to enter in critical section again, he just has to do the same thing. This solution satisfies the bounded waiting requirement by using turn variable. If two processes want to enter in their critical sections, they set their value of flag to TRUE but only the thread can proceed, the other one wait. Question 7Three semaphores mutex, goB, and goC, which are initialized to 1, 0 and 0 respectively [pic 4]All three processes block permanently if Process B start, it decreases mutex by one and mutex is equal to 0, then all semaphores are equal to 0 and all three processes are blockedTwo processes block permanently if Process A execute entirely, then mutex = 1, goB = 1 and goC = 0, then process C start, first line of process C execute then mutex = 0, goB = 1, goC = 0 and process B and C are blockedNo process blocks permanently when Process A execute entirely, then mutex = 1, goB = 1 and goC = 0 then Process B execute entirely and mutex = 1, goB = 0 and goC = 1, then Process C execute entirely and mutex = 1, goB = 0 and goC = 0Question 8Monitor FileControl {Condition readers, writers;int activereaders = 0;boolean writing = False;int waitingwriters = 0 ;WriterEntry() {If (writing > 0)){waitingwriters = waitingwriters+1;writers.wait();

Get Your Essay

Cite this page

Load Of N Processes And Semaphores Mutex. (July 8, 2021). Retrieved from https://www.freeessays.education/load-of-n-processes-and-semaphores-mutex-essay/