THE UNIVERSITY OF WESTERN AUSTRALIA
Department of Computer Science
230.304 CONCURRENT PROGRAMMING
Concurrent Programming Project (2000)
Simulating a Railway Network (Due Date : Midnight, 31st May, 2000)
Submit to : /cslinux/marking/cs304
The Concurrent City Railway Network is a simple railway network
consisting of four railway tracks. Two parallel tracks are from east to
west (Tracks A and B) and the other two parallel tracks are from north
to south (tracks X and Y).
There are five stations on each of the tracks. The small circles
on the tracks in the picture above are the stations. The stations on the
X and Y tracks are numbered from
1 to 5. For example, the stations on the X track are numbered X1, X2, X3,
X4 and X5 from north to south. Similarly, the stations on the A and B tracks
are numbered from west to east. If a station is common to two tracks,
it is called a junction. For example the station X2 or A2 is a junction on
the A and X tracks. Each station can accommodate at most 15 passengers.
There is a train dedicated to each track. The train for a particular
track goes up and down the track stopping at each station. A train can
accommodate up to 20 passengers at a time.
The project is to simulate this network. The simulation starts with each
station having 15 passengers and each passenger has a random destination
station. Hence, it may be necessary for a passenger to change her/his
train for reaching her/his destination. The simulation ends when all the
passengers have reached their destinations. The tasks in the project
can be broadly divided into two categories.
- Designing a simple user interface with the following facilities :
- It should be possible to check the name of the passengers who
are waiting at a particular station.
- It should be possible to check the name of the passengers in each
- The actual simulation program.
Some more specifications
- Each train and each passenger should be a thread.
- We assume that two trains can simultaneously arrive at a station.
So, you need not consider possible collisions.
- You need to experiment with the sleep times of the trains in order
to avoid possible deadlock situations when there is no progress
in the system.
- If necessary, reduce the number of passengers at each station and
the number of passengers in each train. But I think the current numbers
should be ok.
- When a passenger reaches that passenger's destination station, the
corresponding thread dies.
- The aim of the simulation is to see when all the passengers die