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

Define a set of methods that allow executing a program, A set of methods th...

A set of methods that allow executing a program which is not completely in memory   is called A set of methods that allow executing a program which is not completely in memory

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

Describe swapping technique in unix systems, Describe swapping technique in...

Describe swapping technique in UNIX systems. Swapping is used to control memory contention among processes. If there is excessively much memory contention, processes are swappe

Do ratio analysis of financial statements, Do ratio analysis by comparing t...

Do ratio analysis by comparing the four companies financial statements, analysis and interpretation on the four-basic group : (Refer to attachment A) Liquidity ratio Asset

Multilevel queue scheduling algorithm suffer from starvation, 1. Suggest so...

1. Suggest some mechanism(s) to lower the dispatch latency while scheduling for a real-time system. Also, discuss any trade-off or consequent constraint associated with it, if a

What is a process control block?, What is a Process Control Block? Ever...

What is a Process Control Block? Every process in the operating system is represented by a process control block as well called a task control block. It contains several pieces

Read-write locks, Consider a large web-based database. In some sense, Googl...

Consider a large web-based database. In some sense, Google is sort of like this. There might be many users who want to read from the database, but only a few users who are allowed

What does verification represent, What does Verification represent? Ver...

What does Verification represent? Verification shows the set of activities that are carried out to confirm that the software correctly executes the specific functionality.

Describe virtual memory, What is virtual memory? Virtual memory is a me...

What is virtual memory? Virtual memory is a method that allows the execution of processes that might not be completely in memory. It is the separation of user logical memory fr

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