Correct the code for visitor and vehicle portion, 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, a single passenger may climb aboard and drive 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 for the Visitor and Vehicle portions (assume that other portions of the system admit the tasks to the system). 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:- Correct the code for visitor and vehicle portion

Quick, why we say " OS is a resource allocator" and “OS is a control progr...

why we say " OS is a resource allocator" and “OS is a control program"?

Explain the features that bash shell provides, LINUX OPERATING SYSTEM 1...

LINUX OPERATING SYSTEM 1. Write a brief explanation about the Linux distribution. 2. Explain the features that Bash shell provides? 3. Who is responsible for managing use

What is a client server system, What is a client server system? Central...

What is a client server system? Centralized systems proceed as server systems to satisfy request generated by client systems Server system is able to be broadly div

Explain how the system can deal with the starvation problem, Q. Can a syste...

Q. Can a system detect that some of its processes are starving? If you answer "yes," explain how it can. If you answer "no," explain how the system can deal with the starvation pro

How many cubic feet of storage space would require, Q. Presume that we agr...

Q. Presume that we agree that 1 kilobyte is 1,024 bytes 1 megabyte is 1,0242 bytes and 1 gigabyte is 1,0243 bytes. This progression carries on through terabytes, petabytes, and ex

Evolution of operating system, breifly write a note on about evolution of o...

breifly write a note on about evolution of operating system?

What are the issues in designing a network-fault tolerance, Fault tolerance...

Fault tolerance : Machine failures, Communication faults, storage device crashes, and decays of storage media must be tolerated by the system to some extent. A fault tolerant sy

Malloc, I need help implementing malloc

I need help implementing malloc

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