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
What are the use of job queues, ready queues and device queues? As a process enters a system they are put in to a job queue. These queues having of all jobs in the system. The

What is external fragmentation? As process are removed from and loaded to the memory free memory space is bracken into pieces .external fragmentation take place when enough mem

Program of Calculator and Controller with the fork, exec, and wait system calls The objective of this assignment is to get you to be comfortable with the fork(), exec(), and wai

What is meant by demand paging? Explain. Demand paging is a technique to implement virtual memory. In demand paging simply when a page is required it is brought into memory. As

Explain the Types of System Calls The major types of system calls are like this: a. Process Control: These types of system calls are employed to control the processes.

diffenciet between least recently used and not recently used

Let us consider the operation of the EPROM device in more detail. Consider the pining details below again   Before we examine the interface means of the EPROM, it is worth


What is a multiprocessing system? Multiprocessor systems are those systems that use additional than a single processor for program execution. It is done for raising the executi

Did Abhinav agree to the initial timeline requested by Rebecca