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 is the main advantage of the layered approach to system design? As in all cases of modular design, designing an operating system in a modular way has several benefits. Th

What is independent process? A process is independent it cannot influence or be affected by the other processes implementing in the system. Any process does not share data with

Q. Explain about Spooling? Acronym for simultaneous peripheral operations on line. Spooling denotes to putting jobs in a buffer, a special area in memory or on a disk where

Since each thread has its own processing space therefore communication between threads will need to be done through a common global variable. Since multiple threads can access the

what do obelia eat and how do they feed

Page Fault Handling conditions like, where the copy on write bit of a page is set and that page is send by more than one process, the Kernel assign new page and copies the conten

What is operating system?

SEGMENTATION In a memory management system that is properly a programmer views a program to be collection of program components called as segments . Every segment is a logical

Q. Consider the demand-paged computer system where the level of multiprogramming is currently fixed at four. The system was recently deliberate to determine utilization of CPU and

Question: a) Each process is represented in the operating system by a process control block (PCB). The PCB contains many pieces of information associated with a specific proce