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

Explain linked allocation, Linked allocation With linked allocation, ev...

Linked allocation With linked allocation, every file is a linked list of disk blocks; the disk blocks might be scattered anywhere on the disk. The directory has a pointer to th

Multiprogramming., In a multiprogramming and time sharing environment sever...

In a multiprogramming and time sharing environment several users share the system simultaneously .what are two such problems?

What is the use of fork and exec system calls, What is the use of fork and ...

What is the use of fork and exec system calls? Fork is a system call by which a latest process is created. Exec is also a system call, which is used after a fork by one of the

Deadlock prevention-resource allocation graph allocation, Explain Deadlock ...

Explain Deadlock Prevention-Resource allocation graph allocation Resource allocation graph algorithm :  Using this algorithm we are able to actually know if there exists in th

Define deadlock avoidance, Define deadlock avoidance. An alternative me...

Define deadlock avoidance. An alternative method for avoiding deadlocks is to need additional information about how resources are to be requested. Every request requires the sy

Define seek time and latency time, Define seek time and latency time. T...

Define seek time and latency time. The time taken by the head to move to the appropriate cylinder or track is known as seek time. Once the head is at right track, it must wait

Linux OS, Ask questioDevelop a utility in C language which will run in Linu...

Ask questioDevelop a utility in C language which will run in Linux operating systems to display following properties of the system: ? Processor speed ? Ram size ? Computer name ? S

List ways to share directories in operating system, List ways to share file...

List ways to share files among directories in operating systems. a. Copy file from one account into another. b. Link directory entry of "copied" file to directory entry of o

NETWORK OPERATING SYSTEM, explain about design issues of network operating ...

explain about design issues of network operating system

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