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
Q. Explain about Operating System Services? An operating system offers services to programs and to users of those programs. It provided by one environment for execution of

describe main points of multiuser and multi tasking operating systems.

What is parsing Parsing is the procedure of analyzing a text, made of a sequence of tokens, to define its grammatical structure regarding to a given formal grammar. Parsing is

An operating system act as an intermediary between user of a computer and computer hardware. The objective of an operating system is to provide an environment in that a user can ex

What are the different ways in which a thread can be cancelled? Cancellation of a target thread may happen in two different scenarios: Asynchronous cancellation: One thr

Q. Give an instance of an application in which data in a file should be accessed in the following order: a. Sequentially b. Randomly Answer: a. Print the content of


Explain the difference between internal and external fragmentation. Internal Fragmentation is the area in a region or a page that is not used by the job occupying that region o

Q. What are the reasons for process suspension? Reasons for process suspension 1.  Swapping 2.  Timing 3.  Interactive user request 4.  Parent process request

Transferring files from Windows to Unix Be very careful transferring files from Windows to Unix. If you do transfer a file from Windows to Unix open the file, in Unix, using vi