Example of semaphore, Operating System

Assignment Help:

For example, by initializing a semaphore to 0, threads can wait for an event to occur, and impose an ordering constraint, similar to a monitor using condition variables, but with memory: semaphore sem=0; // 0==locked for a semaphore


thread A
down(sem) // wait for thread B; note sem has memory!
// do stuff
thread B
// do stuff, then wake up A
up(sem)


Related Discussions:- Example of semaphore

What are the advantages of contiguous allocation, What are the advantages o...

What are the advantages of Contiguous allocation? The advantages are a. Supports direct access b. Supports sequential access c. Number of disk seeks is minimal.

Prevention of a data race in a parallelised program, Present your own fully...

Present your own fully documented and tested programming example illustrating the prevention of a data race in a parallelised program. This is an example where total number of p

Define jobs which are admitted to the system for processing, Define the Job...

Define the Jobs which are admitted to the system for processing is called The Jobs which are admitted to the system for processing is known as long-term scheduling.

Briefly discuss on page replacement, Briefly discuss on page replacement? ...

Briefly discuss on page replacement? Page replacement approach is fixed as follows. If no frame is free, we search one that is not presently being used and free it. We can fre

What is starvation?, What is starvation? A main problem related to dead...

What is starvation? A main problem related to deadlock is starvation. Starvation is the circumstances where process waits indefinitely within the semaphore. Indefinite blocking

Explain about memory-management scheme, Q. In the IBM/370 memory protectio...

Q. In the IBM/370 memory protection is offered through the use of keys. A key is a 4-bit quantity every 2K block of memory has a key (the storage key) associated with it. The CPU

What are the main challenges for mobile computing, Question: (a) What ...

Question: (a) What are the main challenges for Mobile Computing? (b) What is the ISM band and what is particular about this frequency band? Name two wireless technologies

Operating system components, Question 1 Discuss the following with respect ...

Question 1 Discuss the following with respect to Operating Systems: Operating System Components Operating System Services Question 2 Describe the theory behind Pagin

How many page faults take place in lru replacement, Q. Consider the subseq...

Q. Consider the subsequent page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6. How many page faults would take place for the following replace

What is meant by the phrase thread-safe, The term thread-safe in computer p...

The term thread-safe in computer programming describes that routine or portion of the program that may be called from multiple programming threads without uncalled for interactions

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