Advanced synchronization in operating system, Operating System

Recall that condition variables are synchronization primitives that enable threads to wait until a particular condition occurs.

Generalizing, the combination of locks and condition variables is sometimes called a monitor, which is sometimes incorporated into data structures in some languages (note that this termi- nology is not always used in a standardized way).

Previously,we discussed howto use condition variables and signals to implement a simple producer- consumer system. Looking at this system again, could we move the signal() call in enqueue() down below the unlock()?

dequeue()
lock(A)
while (queue empty)
wait(A, C)
remove_item()
unlock(A)
enqueue()
lock(A)
insert_item()
// used to signal here, inside lock
unlock(A)
signal(C) // now signal here, outside lock

Will this work? The answer is yes. It might not be as clean conceptually, but nothing bad will happen (verify this for yourself).

Posted Date: 3/12/2013 5:18:51 AM | Location : United States







Related Discussions:- Advanced synchronization in operating system, Assignment Help, Ask Question on Advanced synchronization in operating system, Get Answer, Expert's Help, Advanced synchronization in operating system Discussions

Write discussion on Advanced synchronization in operating system
Your posts are moderated
Related Questions
What are the objectives for a file management system? To meet the data management wants and requirements of the user, which embrace storage of data and the ability to

Explain Process scheduling Process scheduling consists of the subsequent sub-functions: 1.      Scheduling : Selects the process to be implement next on the CPU 2.      D

What is a Latency Time Latency Time is the time required through a sector to reach below read/write head.

What is contiguous allocation? Allocation of a group of consecutive sectors for a one file.

What are the disadvantages of linked allocation? The drawbacks are a. Used only for sequential access of files. b. Direct access is not supported c. Memory space neede

What is virtual memory? Virtual memory is a method that allows the execution of processes that might not be completely in memory. It is the separation of user logical memory fr

Explain about threading issues? The fork and exec system calls In a multithreaded program of few UNIX systems have chosen to have two versions of fork, one that duplicates e

Evicting the most-recently used (MRU) page does very well on LRU's worst case. In general, however, MRU is a bad idea, since many programs exhibit temporal locality in their memory

Example 1.  The diagram illustrating the data structures of in-memory VFS objects and on-disk objects and their relationships on slide 24 of the lecture notes OSD.4. This diagram i

Process termination A process terminates when it finishes implementing its final statement and asks the operating system to delete it by using the exit system call. At that tim