Question: Operating Systems Answer the following on Synchronization: 7.How does the signal ( ) operation associated with monitors differ from the corresponding operation defined for semaphores?

Operating Systems

Answer the following on Synchronization:

7.How does the signal ( ) operation associated with monitors differ from the corresponding operation defined for semaphores?

8.A file is to be shared among different processes, each of which has a unique number. The file can be accessed simultaneously by several processes, subject to the following constraint: The sum of all unique numbers associated with all the processes currently accessing the file must be less than n. Write a monitor to coordinate access to the file.

9. The following is a monitor implementation of the Bounded_Buffer Problem. Fill in the blanks with the proper synchronization functions, using MAX_ITEMS, 0, full.wait(), full.wakeup( ), empty.wait( ) and empty.wakeup ( )

monitor bounded_buffer {
private:
 int items [MAX_ITEMS};
 int numItems = 0;
 condition_variable full, empty;
 
public:
 void produce (int data) {
 while (numItems == MAX_ITEMS) 2._____________;
 items[numItems++] = data; 
 3._________________;
 }
 int consume ( ) {
 int retData; // data consumed from buffer
 while (numItems == 4._____) 5.____________
 retData = items[--numItems];
 6._______________;
 return retData;
 }

10. Servers can be designed to limit the number of open connections. For example, a server may wish to have only N socket connections at any point in time. As soon as N connections are made, the server will not accept another incoming connection until an existing connection is released. Explain how semaphores can be used by a server to limit the number of concurrent connections.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!