Semaphore examples, Operating System

Assignment Help:
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();
}
}

Related Discussions:- Semaphore examples

What is directory, What is Directory? The device directory or simply ca...

What is Directory? The device directory or simply called as directory records information-such as name, location, size, and type  for all files on that certain partition. The d

What is the use of inter process communication, What is the use of inter pr...

What is the use of inter process communication. Inter process communication gives a mechanism to allow the co-operating process to communicate with each other and synchronies t

Illustrate advantages and inconveniences of klt, ADVANTAGES AND INCONVENIEN...

ADVANTAGES AND INCONVENIENCES OF KLT Advantages: the kernel be able to simultaneously schedule many threads of the same process on many processors blocking

Write a script in linux to match a data directory, Write a script that uses...

Write a script that uses this idea to print output similar to the following: Files in this directory that match *~ : bash-scripts.html~ chimpanzee~ countdown~ countd

What are the typical elements of a process image, What are the typical elem...

What are the typical elements of a process image? User data: Modifiable part of user space. May have program data, user stack area, and programs that might be modified. User

Explain variable partitioning in memory management, VARIABLE PARTITIONING ...

VARIABLE PARTITIONING We can differ the partitions and change the location according to the size of the process.   50k 40k

Explain about interprocess communication, Explain about interprocess commun...

Explain about interprocess communication The cooperating processes communicate with each other via an interprocess communication facility. IPC gives a mechanism to permit proce

Explain the os/2 operating system, Explain the OS/2 Operating System Li...

Explain the OS/2 Operating System Like NetWare, OS/2 manage resources at three levels, as shown in Figure 4.5 Resources may be maintained at the session, process, and thread le

Unix , A friend has promised to log in at a particular time. However, he ne...

A friend has promised to log in at a particular time. However, he needs to be contacted as soon as he logs in. The shell script checks after every minute whether he has logged in o

Difference between message passing and shared memory, Problem: a) To en...

Problem: a) To ensure proper operation, the operating system and all the other programs must be protected from any malfunctioning program. Describe a mechanism which is impleme

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd