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
What is Multiprogramming? Multiprogramming is the capability of am operating system to support multiple applications running concurrently. Multiprogramming simply means that an

You must use fork and pipe to complete this project. This project creates processes to add all numbers in a file. The user will enter a number (1, 2, or 4) of parallel processes

Scalability : Scalability is the competence of the system to adapt to increased service load. A scalable system will respond more gracefully to increased load than a non-sc

Explain about paging? Answer: Paging is a memory-management scheme that permits the physical-address space of process to be noncontiguous. Paging avoids the considerable proble

Assume there are only 4 page frames in the physical memory, for the following reference string: 1, 2, 3, 4, 5, 3, 4, 1, 6, 7, 8, 7, 8, 9, 7, 8, 9, 5, 4, 5, 4, 2, 8. a) What i

Determine what the “blocking factor” of a file is Blocking factor is the number of logical records in one physical record

While it is hard to resolve a deadlock which has been detected, fortunately it is fairly easy to prevent deadlocks from ever happening. The key is that the conditions above for dea

MEMORY MANAGEMENT USING BUDDY SUSTEM Here we are dividing the memory as powers of two as well as we are selecting the space which is smallest but large enough to hold a process

Question: a) What do you understand by Active directory domain in Windows Server 2008? Support your answer with a diagram. b) Distinguish between active directory trees

What is the purpose of system calls? System calls permit user-level processes to request services of the operating system.