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
Problem 1: (a) What are the likely benefits which an organisation may derive from the planning process? (b) Explain the main reasons why an organisation may fail to plan.

Define FIFO Page Replacement Algorithm This policy simply eliminates pages in the order they arrived in the main memory. By using this policy we simply remove a page based upo

Question 1 What is a message passing system? Discuss the desirable features of a message passing system Question 2 Discuss the implementation of RPC Mechanism in detail Q

Question: OS Installation / File system a) Why is NTFS portioning preferred over FAT16 or FAT32 when security is of primary concern? b) State a situation or an application w

Q. The accelerating search for described in subsequent exercise is typical of hard-disk drives. By contrast floppy disks and several hard disks manufactured before the mid-1980s t

This assignment is based on Programming Project 6.40 in Silbershatz. Implement the ProducerXConsumer program according to the instructions for Project 6.40 for both Linux and Win32

Compare contiguous-memory allocation with pure paging in the following aspects: 1. In support of dynamic memory allocation: most systems allow programs to allocate more memory t

What is critical section problem? Consider a system consists of 'n' processes. Every process has segment of code called a critical section, in which the process might be changi

Convert the following from hex to binary and draw it on the memory map.     RAM    = 0000 -> 00FF     EPROM = FF00  -> FFFF Answer:   0000  0000 0000  0000 (0)    RAM sta

Transparency : Users must be able to access remote resources as though these resources were local. Transparency should as well promote user mobility. Users must be allowed to lo