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
Explain why SSTF scheduling tends to favor middle cylinders over the innermost and outermost cylinders. The center of the disk is the location having the fewest average distanc

Q. Provide two programming instances in which multithreading provides better performance than a single-threaded solution. Answer: (1) A Web server that services every request

Refer a program with a linked origin of 5000. Suppose the memory area allocated to it have the start address of 70000. Determine the value to be loaded in relocation register?

What are the various disk-scheduling algorithms? The several disk-scheduling algorithms are a. First Come First Served Scheduling b. Shortest Seek Time First Scheduling

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

OPERATING SYSTEM 1. Describe the term operating system. Write down the functions of operating system. 2. Explain Thread? Write down the advantages and disadvantages of threa

What is the use of FIFOs in client-server applications

Explain a working of file control block A file control block (FCB) has information about the file, containing ownership, permission, and location of the file contents. The log

Question 1 Explain with diagram all possible states a process visits during the course of its execution Question 2 Discuss Inter-process Communication. What is critical-secti

Compare user threads and kernel threads. User threads:- User threads are supported above the kernel and are executed by a thread library at the user level. Thread creation