Analysis of Pseudocode Sempahore Solution, Operating System

Assignment Help:
Gopher Gallery consists of a shopping mall and a cart ride that covers the 150 acre habitat. There are m visitors and n single-person vehicles. Visitors stroll around the mall at their leisure, then line up for the cart ride. When a cart is
available, it allows the single passenger to climb aboard and drives around the habitat for a random amount of time. If the n carts are all taken, then a future rider waits; if a vehicle is available but no one is waiting, then the vehicle waits.
The solution to this problem must synchronize visitor tasks and vehicle tasks using semaphores.
Below is a potential solution. Correct any issues with this code, if any exist.
Explain your position in detail.

Semaphore vehicleAvailable = 0, vehicleTaken = 0, vehicleFilled = 0, visitorReleased = 0;

Visitor()

{
vehicleAvailable.wait();
vehicleTaken.signal();
vehicleFilled.wait();
visitorReleased.wait();

}

Vehicle()

{
while(True)
{

vehicleAvailable.signal();
vehicleTaken.wait();
vehicleFilled.signal();
Drive through habitat for some arbitrary amount of time;
visitorReleased.signal();

}
}

Related Discussions:- Analysis of Pseudocode Sempahore Solution

Briefly discuss on i/o hardware, Briefly discuss on I/O hardware? A con...

Briefly discuss on I/O hardware? A controller is a collection of electronics that can operate a port, a bus, or a device. A serial-port controller is an easy controller. It is

What are the advantages and disadvantages of multithreading, What are the a...

What are the advantages and disadvantages of multithreading?  Advantages : Since by multithreading multiple executions are carried out in the same process environment t

Parent process: why not finishing and how to make finish, #include #inclu...

#include #include #include #include #include int main(void) { int pchan[2], pid, rval, cvar; char buf[20]; if (pipe(pchan) == -1){

Explain next fit algorithm, NEXT FIT ALGORITHM Here scanning starts fro...

NEXT FIT ALGORITHM Here scanning starts from the first fit position and then it finds the next position which is large sufficient to hold the process. Thus the name next fit.

Timers could be utilized to compute the current time, Q. Timers could be ut...

Q. Timers could be utilized to compute the current time. Provide a little description of how this could be accomplished. Answer: A program could utilize the following ap

Explain two level directory, Two Level Directory This kind of structure...

Two Level Directory This kind of structure overcomes the problems of assigning unique names to the files. Thus there need not be any confusion among users. In this kind of s

Blocking locks, We have talked about blocking locks, which voluntarily yiel...

We have talked about blocking locks, which voluntarily yield, and spinlocks, which just spin until they acquire the lock. At ?rst, it seems like spinlocks are verywasteful, and tha

Plot a function for value of heights, The performance of a file system depe...

The performance of a file system depends upon the cache hit rate (fraction of blocks found in the cache). If it takes 1 msec to satisfy a request from the cache, but 40 msec to sat

Comparing gc to malloc, Garbage collectors trade space for time. If we coll...

Garbage collectors trade space for time. If we collect all the time (which requires a lot of processing time), the GC allocator will use the least memory possible. On the other han

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