Example of semaphore, Operating System

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)

Posted Date: 3/12/2013 5:23:25 AM | Location : United States







Related Discussions:- Example of semaphore, Assignment Help, Ask Question on Example of semaphore, Get Answer, Expert's Help, Example of semaphore Discussions

Write discussion on Example of semaphore
Your posts are moderated
Related Questions
properies of Batch oriented and interactive operating system.

What are the different methods for handling deadlocks? Deadlock detection and recovery: Permit the system to enter a deadlock state, detect it and after that rec

Explain the Advantages and Drawback of Multiple Processes Application architected to take advantage of multiple processes will certainly see performance gains. Functions and Fe


Question: (a) Explain the similarities and differences between two different threads running in the same process and two independent processes. When would you want to use two t

Question 1: a) Distinguish between "Long-Term Scheduler" and "Short-Term Scheduler". b) Describe the benefits of "Threads". c) Name three types of CPU Scheduling. Que

Synchronization can be achieved by means other than locks and condition variables. One alternative is semaphores. A semaphore is used to regulate traf?c in a critical section. A se

General graph directory The serious problem with using an acyclic-graph structure is ensuring that there are no cycles. When we insert links to an existing tree-structured dire

The term IPC (Inter-Process Communication) defines several paths by which different process executing on some operating system interact between each other.

Q. State three merits of placing functionality in a device controller rather than in the kernel and State three disadvantages. Answer: Three advantages: Bugs are less probabl