Advanced synchronization in operating system, Operating System

Assignment Help:

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).


Related Discussions:- Advanced synchronization in operating system

We can view an operating system as a resource allocator, We can view an ope...

We can view an operating system as a resource allocator. Explain. We can outlook an operating system as a resource allocator. A computer system has Many resources (software and

What is the sequence in which resources may be utilized, What is the sequen...

What is the sequence in which resources may be utilized? Under normal mode of operation, a process may utilize a resource in the following sequence: Request: If the requ

What are the major differences between operating systems, Q. What are the m...

Q. What are the major differences between operating systems for mainframe computers and personal computers? Answer: In general operating systems for batch systems have simpler

What are the various page replacement algorithms, What are the various page...

What are the various page replacement algorithms used for page replacement? FIFO page replacement Optimal page replacement LRU page replacement LRU approximat

necessary conditions for a deadlock , Q) a. Given that the first three nec...

Q) a. Given that the first three necessary conditions for a deadlock are in place, comment on the feasibility of the following strategy. All processes are given  unique priorities.

Unsafe state, discuss unsafe state in operating system

discuss unsafe state in operating system

What is segmentation?, SEGMENTATION In a memory management system that ...

SEGMENTATION In a memory management system that is properly a programmer views a program to be collection of program components called as segments . Every segment is a logical

Deadlock prevention, While it is hard to resolve a deadlock which has been ...

While it is hard to resolve a deadlock which has been detected, fortunately it is fairly easy to prevent deadlocks from ever happening. The key is that the conditions above for dea

Explain lru page replacement, LRU page replacement In slightest recentl...

LRU page replacement In slightest recently used page replacement algorithm we will replace that page that hasn't been used for the longest period of time. This is similar as an

What is a sequential file, What is a sequential file? A file that is re...

What is a sequential file? A file that is read one record or block or parameter at a time in order, based on a tape model of a file.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd