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
Define request edge and assignment edge. Answer:  A directed edge from process Pi to resource type R j is denoted by Pi->j; it signifies that process Pi requested an instance

In modern operating systems, applications do not directly access the physical memory. Instead, they use so-called virtual memory, where each virtual address is translated to a phys

Q. Researchers have recommended that instead of having an access list associated with each file (specifying which users can access the file and how) we should have a user control

Q. Operating System as User Interface? • Every general purpose computer comprises the operating system, hardware, system programs and application programs. The hardware compris

Some people write custom memory allocators to meet their speci?c needs. Although this is not needed for most of the applications, it is also not uncommon. The goal, of course, is t

Ask question maxmum words accepted#

What is real time system? A real time system has well explained, fixed time constraints. Processing must be done within the explained constraints, or the system will fail. It i

describe main points of multiuser and multi tasking operating systems.

Explain a boot control block A boot control block can have the information required by the system to boot an operating from that partition. If the disk does not have an operati

Ask using a laballed diagram explaining the architecture of windows operating ststem