0% found this document useful (1 vote)
2K views2 pages

Sessional 1 Ans

The document discusses several questions related to operating systems concepts. It explains how the total execution time of processes can exceed the sum of individual process times due to idle CPU time during I/O operations. It classifies example applications as batch-oriented or interactive. It also describes how mutual exclusion can be implemented using mailboxes to allow only one process in the critical section at a time.

Uploaded by

Kashika Mehta
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
2K views2 pages

Sessional 1 Ans

The document discusses several questions related to operating systems concepts. It explains how the total execution time of processes can exceed the sum of individual process times due to idle CPU time during I/O operations. It classifies example applications as batch-oriented or interactive. It also describes how mutual exclusion can be implemented using mailboxes to allow only one process in the critical section at a time.

Uploaded by

Kashika Mehta
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Subject: Operating Systems Q.

1 Consider that a multiprogrammed system has a load of N processes with individual total execution times of t1, t2, t3, .., tN , How would it be possible that T > (t1 + t2 + t3, ..+ tN ) ? where T is total execution time. That is, what could (two) causes the total execution time to exceed the sum of the individual process execution times? Ans. The execution time could exceed the sum of the individual execution times if the system was unable to overlap I/O with processing, even across processes and switching time among processes. That is, there will be times when the CPU is idle, yet the system is performing I/O for some of the processes. Q.2 Classify the following applications as batch-oriented or interactive. Justify your answer. (Attempt any five) a. Word processing: Interactive b. Generating monthly bank statements: Batch c. Computing pi to a million decimal places: Batch This job is 100% CPU-bound. A batch system without multiprogramming would attain nearly 100% CPU utilization running this program. d. Generating personal 1040 tax returns: Interactive e. Generating employee W-2 tax forms: Batch f. A flight Simulator: Interactive Q. 3 Indicate how mutual exclusion could be implemented using mailboxes with non-blocking send_mailbox and blocking receive_mailbox primitives. Assume the primitives are executed as indivisible atomic operations. Ans. After creating and initializing a mailbox mutex to have a single message, any process wishing to enter its critical section must attempt to receive a message. Only when a process actually receives a message can it enter its critical section. When it leaves its critical section, it returns the message it received back to the mailbox. Since there is only one message, only one process message, only one process can be in its critical section at a time. receive_mailbox (mutex, message); //critical section send_mailbox (mutex, message); Q. 4 Complete the following scenario, it is related to Interprocess Communication Patterns (Write your answer in very short to the point (as possible)) Process competition for resources Context: the use of shared resources physical and logical resources serially reusable resources Problem: race conditions Where the problem occurs: critical sections Abstract solution: atomic actions Concrete solution: mutual exclusion (of critical sections) Q: 5 Answer: If a processor occurs more than once in the round-robin list, then it will get two turns for

each pass through the list. One reason for allowing this would be to implement a primitive priority system since the more times it occurs on the list, the higher the percentage of time the CPU will spend on that process. Q: 6Answer: There is a possibility of starvation here. Suppose process j is in critical section and process i is busy waiting at the inner while loop. Now when process j exits the critical section it sets turn = i, but it immediately tried to access the critical section and so sets inside[j] = true. Right before process j executes while (inside[i]), scheduler schedules process i. Now process i exits from the inner while loop as turn = = i now, but it finds inside[j] to be true so continue the outer while loop. Then after it executes inside[i]=false, the scheduler schedules process j and it finds the condition at outer while loop to be false and enters the critical section. As a result, process i busy waits at outer while loop. These steps can repeat arbitrary number of times and that starves process i and it may never enter the critical section. In the original algorithm, there is an extra checking if (turn==j) which ensures that this starvation never happens.

You might also like