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
Removing System Dependencies Because portions of the client - server application program may execute on different machines, it is very important for the developer to remove the

What is super block A partition control block have partitions details, such as the number of blocks in the partition, size of the blocks, free-blocks and free-block pointers an


What is page fault? In the computer storage technology a page fault is an exception which is raised by the memory management unit when a requested page isn't mapped in physical

Multitasking - An Operating systems that is proficient of allowing multiple software processes to be run at the same time. Below are some instances of multitasking Operating Syste

What are the various process scheduling concepts? a) Scheduling queues with diagram b) Queuing diagram c) Schedulers d) Context switch with diagram

Question: (a) Red Hat Linux is distributed under the Open Source agreement. Explain what you understand by Open Source distribution system. (b) Write a short note on the L

Q. Explain the File-system manipulation? File-system manipulation there is several details in file allocation, creation, deletion and naming that users should not have to perfo

There are three kinds of Data Abstraction: Physical level: The minimum level of abstraction defines how data are saved. Logical level: The next bigger level of a