Semaphore examples, Operating System

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 time when the ride is available. If y number of rides are taken, the visitors have to wait for a ride to become available. If the ride is available but no visitor is then the ride waits.

So this is what i got so far this is all just psudo code I dont really need this to work I just need to wrap my head around the semaphore thing

Semaphore rideAvaliable = 0. rideTaken = 0, rideFilled = 0, visitorReleased = 0;


Visitor()
{
rideAvaliable.wait();
rideTaken.signal();
rideFilled.wait();
visitorReleased.wait();
}

Vehicle()
{
while(TRUE)
{
rideAvaliable.signal();
rideTaken.wait();
ride.Filled.signal();
Drive around for a bit
visitorReleased.signal();
}
}
Posted Date: 11/1/2012 9:12:47 AM | Location : United States







Related Discussions:- Semaphore examples, Assignment Help, Ask Question on Semaphore examples, Get Answer, Expert's Help, Semaphore examples Discussions

Write discussion on Semaphore examples
Your posts are moderated
Related Questions
Ask question maxmum words accepted#

Q. The RC 4000 system as well as other systems have defined a tree of processes (called a process tree) such that all the descendants of a process are given resources (objects) as


Q. State three merits of placing functionality in a device controller rather than in the kernel and State three disadvantages. Answer: Three advantages: Bugs are less probabl

UNIX systems utilized to use disk-layout optimizations based on the rotation position of disk data however modern implementations including Linux simply optimize for sequential dat

When we download a movie from the Internet, we don't care about, say, packet sizes. However, even ifwe are not aware of howlow-level details of networks are implemented, our data i

Suppose your process starts up, and allocates some memory with malloc(). The allocator will then give part of a memory page to your process. The OS then updates the corresponding p


Smith, who is a civil engineer, purchased a 30-hectare block of land in Australia in 1986 and used two hectares of it as a main residence. The part that was not main residence cost

explain about oprating system services and topics briefly