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

Lexical substitution during macro expansion, Lexical substitution during ma...

Lexical substitution during macro expansion Lexical substitution is employed to produce an assembly statement from a model statement. A model statement contains 3 types of stri

Linux, write a linux command to display lines from 25 - 45 of directory "/e...

write a linux command to display lines from 25 - 45 of directory "/edc/password"

Explain about directory structure, Normal 0 false false fal...

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

Information system can be divided into three task areas, From hardware pers...

From hardware perspective, every information system can be divided into three task areas Presentation, Application Logic and Data Storage. The R/3 Basis software is extremely s

What is logical address space and physical address space, What is logical a...

What is logical address space and physical address space? The set of all logical addresses formed by a program is known as a logical address space; the set of all physical addr

The key challenges of distributed systems, Question 1 Explain the followin...

Question 1 Explain the following with respect to Resource Management in Distributed Systems- Task assignment Approach Load - Balancing Approach Load - Sharing Approach

What is the resident set and working set of a process, What is the resident...

What is the resident set and working set of a process? Resident set is that portion of the process image that is actually in real-memory at a certain instant. Working set is th

Explain nonvolatile - volatile and stable storage, Q. Explain the differenc...

Q. Explain the differences in terms of cost between the three storage types nonvolatile, volatile and stable. Answer: Volatile storage refers to main as well as cache memory an

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