Example of semaphore, Operating System

Assignment Help:

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)


Related Discussions:- Example of semaphore

Explain the spawnvp function used in the netware, Explain the Spawnvp Funct...

Explain the Spawnvp Function used in the netware Spawnvp(flags, execNmae, argv)   This function executes  similarly to spawnlp( ) except that parameters are passed as a v

Define thread cancellation and target thread, Define thread cancellation & ...

Define thread cancellation & target thread. The thread cancellation is the task of terminating a thread before it has completed. A thread that is to be cancelled is often refer

Rf, whta is an operating system ? what sorts services are provided by an op...

whta is an operating system ? what sorts services are provided by an operating system ?

Write a short note about context switch, Write a short note about context s...

Write a short note about context switch. Switching the CPU to another process needs saving the state of the old process and loading the saved state for the new process. This ta

Real time operating system, PART A Question 1 Using your own words...

PART A Question 1 Using your own words, explain what a continuous random variable and a continuous probability density function are. Give examples. Question 2 Gi

What is the use of FIFOs in client-server applications, What is the use of ...

What is the use of FIFOs in client-server applications

Describe the benefits of using microkernels, Question: (a) (i) What is ...

Question: (a) (i) What is a microkernel? Describe the benefits of using microkernels. (ii) How does a microkernel-based operating system differ from a traditional operating

What is the information associated with an open file, What is the informati...

What is the information associated with an open file? Various pieces of information are associated with  an open file which may be: File pointer Disk location of th

Computer organisation, basic advantage of using interrupt initiated data tr...

basic advantage of using interrupt initiated data transfer over transfer under program control without an interrupt

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd