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 about deadlock prevention? In order for the occurrence of deadlock, the four conditions like mutual exclusion, hold and wait, no pre-emption and  circular wait must hap

What are the benefits of multiprogramming? Responsiveness : Multithreading is an interactive application may permit a program to continue running even if part of it is block

#question.explain varios types of system calls..

wat are the commands used for creating the file hierarchy

What are the five major activities of an operating system in regard to process management? The creation and deletion of both user and system processes The suspension and res

Q. What is the basic function of Assembler ? Input to an assembler is an assembly language program. Output is an object program and information which enables the loader to prep

A system consists of 10 units of resource class Ru. The resource needs of three user processes P1, P2 and P3 are like this                     Using Banker's algorithm, de

___paging fecthces a page only when needed

Explain the Request or Response interface The Request/Response interface is ideal for a message based client-server interaction. By modeling components to interact via a reque

Ok so i think i got this right by not 100% on this. what I want to figure out is if there are x visitors that can line up for a ride but only 1 passenger can get on the ride at a t