Reference no: EM13167046
For the FIFA World Cup 2006, a fly-over has been constructed between the hotel where the teams are staying and the stadium. This fly-over will be used by the German team and the Italian team in their upcoming exhibition match. A tram car is used to cross this
fly-over, but it seats only four people, and must always carry a full load.
We cannot put three Italians and one German in the same tram-car, because the Italians
would be in majority and might try to intimidate the German. Similarly, we cannot put
three Germans in the same tram-car with one Italian. All other combinations are safe.
You are required to code two processes; the first shall simulate the arrival of German
players and the other the arrival of Italian players. These players can come at any time, in any
order to cross the fly over. The first process shall call a procedure called GermanHere
on the arrival of a German player. Similarly, the second process shall call a procedure
called ItalianHere on the arrival of an Italian athlete. As soon as a safe combination
is reached, the tram starts and crosses to other side. Assume that a tram is always
available when required.
Use semaphores to implement the solution. The Germans and Italians should not wait if
there are enough of them for a safe tram-car load. The two processes will simulate the
arrival of players at random intervals and should run for a while to show around 10 trams
leaving with different safe combinations. Before terminating you must clean up the
semaphores and shared memory segments from the system.
You must output the progress of the processes. E.g. when a player arrives you should
output who arrived and also print the total number of Germans and Italians waiting to
board the tram. When a tram leaves you should output that as well.
Your code should include well written comments and at the beginning, you should
explain your strategy for solving the problem.
Explain the concept of locality of reference
: 1. Explain the concept of locality of reference and state its importance to memory systems.
|
Which a ball is released from a user-defined height
: Write a program in which a ball is released from a user-defined height and free-falls to the ground. The ball is pulled by earth's gravity of 9.8 m/sec 2 . Assume that each pixel represents
|
Create a text-based, menu-driven program
: Create a text-based, menu-driven program that allows the user to choose whether to add, subtract, multiply or divide two numbers. The program should then input two double values from the use
|
Search the web for security education and training program
: Search the Web for security education and training program in your area. Keep a list and see which category has the most examples. See if you can determine the costs associated with example. Which do you think would be more cost-effective in terms of..
|
For the fifa world cup 2006
: For the FIFA World Cup 2006, a fly-over has been constructed between the hotel where the teams are staying and the stadium. This fly-over will be used by the German team and the Italian team in their upcoming exhibition match. A tram car is used t..
|
Write a java program that reads a five-line address
: Write a Java program that reads a five-line address from an input file and produces an output file with the address repeated 50 times in three columns.
|
Define a class called counter
: Define a class called Counter. An object of this class is used to count things, so it records a count that is a non negative whole number. Include methods to set the counter to 0, to increase the count by
|
Prompts for an int8 value to inspect and then prints
: Write an HLA Assembly program that prompts for an int8 value to inspect and then prints it in binary format.
|
Temporarily move to the street so that the
: Driveway is a "last-in, first-out" stack. Of course, when a car owner retrieves a vehicle that wasn't the last one in, the cars blocking it must temporarily move to the street so that the requested vehicle can leave
|