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 meant by arm-stickiness? If one or a few processes have a high access rate to data on single track of a storage disk, then they might be monopolizing the device by repe

Q. Explain the actions taken by a kernel to context switch between kernel level threads. Answer: Context switching among kernel threads classically requires saving the value

Placement algorithms :calculate where in available real-memory to execute a program. Common functions are next-fit, first-fit, and best-fit. Replacement algorithms :are

As mentioned above, page tables, are lookup tables mapping a process' virtual pages to physical pages in RAM. How would one implement these page tables? The most straightforward

Define busy waiting and spinlock. When a process is in its significant section, any other process that tries to enter its critical section must loop continuously in the entry c

FIXED PARTITIONING In a fixed partitioning, the operating system inhabiting some fixed portion of main memory is available for use of multiple processes -Using fixed partit

Question 1: a) Briefly explain each of the following terms: (i) Distributed systems. (ii) Real time systems. (iii) Multiprocessor. b) What is the impo

Question: a) The following questions refers to Windows XP networking: i) Briefly, explain how a host joins a network using DHCP? ii) Which IP address could be assigned to a

Define busy waiting and spinlock. When a process is in its significant section, any other process that tries to enter its critical section must loop continuously in the entry c

Question: (a) Answer the following questions based on the code snippet below. 1. int main (int argc, char *argv[]) 2. { 3. 4. pid_t processId; 5. 6. processId =