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
explain hierarchical,hashed and inverted paging

Networks and operating systems have a lot of overlap. In this course, however,we are not going to discuss networking in detail, but rather focus on the networking abstractions prov

Introduction of linux

Now we consider the following questions: how can the parent process communicate with its child? Or how can children processes communicate with other children? The exact answer depe

Major page fault: If the page is not loaded in memory at the time the fault is stated, then it is named major or hard page fault. The handler in the machine requires to search a

Symmetric multiprocessing To get maximum reliability and efficiency a mode of function called as symmetric multiprocessing is used. In essence, with SMP any program or threads

When a program issues a memory load or store operation, the virtual addresses (VAs) used in those operations have to be translated into "real" physical memory addresses (PAs). This

Define buffering. A buffer is a memory area that keeps data whereas they are transferred among two devices or among a device and an application. Buffering is done for three rea