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
importance of Operating system in modern computers. Also explain various functions & types of operating systems

Q. It is occasionally said that tape is a sequential-access medium whereas magnetic disk is a random-access medium. In fact the correctness of a storage device for random access d

Give a brief introduction about the operation of your program and show that you understand the idea behind threads and mutual exclusion variable. Why do we need to use mutual exclu

Write a brief note on demand paging. A demand paging is alike to a paging system with swapping. The Processes reside on the secondary memory while we want to implement a proces

what are the design issues of network OS

Define dynamic loading. To obtain better memory-space utilization dynamic loading is used. With dynamic loading, a routine is not loaded until it is called. All routines are ke

define semaphore. how can we use semaphore to deal with n-process critical section problem.

Explain thread in details

Purpose This is intended to help you develop your understanding of shell scripting in both a Windows and Unix environment. Deliverables For both the first and second op

Show the search tree generated by Hill-Climbing search (text figure 4.2, page 122; or Local Search lecture, slide 6) for each of the two heuristics (a) and (b) applied to the follo