Closed

Analyze and correct psuedocode solution implementing synchronization with semaphores

This project received 3 bids from talented freelancers with an average bid price of $67 USD.

Get free quotes for a project like this
Employer working
Skills Required
Project Budget
$10 - $30 USD
Total Bids
3
Project Description

Bison World consists of a shopping mall and a buffalo 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 buffalo ride. When a buffalo vehicle is available, it allows the single passenger to climb aboard and drives around the habitat for a random amount of time. If the n buffalo vehicles 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. Assume initialization code exists. Correct any issues with this code, if any exist. Explain your position in detail.

Semaphore vehicleAvailable = 0, vehicleTaken = 0, vehicleFilled = 0,
visitorReleased = 0;
Visitor()
{
[url removed, login to view]();
[url removed, login to view]();
[url removed, login to view]();
[url removed, login to view]();
}
Vehicle()
{
while(True)
{
[url removed, login to view]();
[url removed, login to view]();
[url removed, login to view]();
Drive through habitat for some arbitrary amount of time;
[url removed, login to view]();
}
}

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online