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
1. A digitized voice channel is made by digitizing a 7 KHz bandwidth analog signal. The signal is to be sampled twice the highest frequency (two samples per hertz) . Assume each sa

The code should be nicely formatted with plenty of comments. It should be easy to read, properly The summary section should include three parts: (1) Record the running t

Another solution then would be to keep a pool of threads. Whenever a new task arrives, the system would simply get a thread from pool and set that thread to work on the given task.

Single level directory: This is the easiest directory structure. All the files are controlled in the same directory, which is simple to support and understand. Few of the li

FIFO is named as 'named pipes'. FIFO (first-in-first-out) is a special file which is laid to be data transient. Once data is load from named pipe, it cannot be load again. Also, da

explain hierarchical,hashed and inverted paging

What is preallocation? Why do it? Allocating space for a file before making the file to allow for expansion. This reserves space for a certain file so that other files can't gr

What is a Process Control Block? Every process in the operating system is represented by a process control block as well called a task control block. It contains several pieces

General Graph Directory A serious trouble with using an acyclic graph structure is making sure that there are no cycles. When links are further added to an existing tree struc

Facilities of a Debug Monitor Facilities of a debug monitor are like this: Setting breakpoints in the program Initiating a debug conversation while control reaches