This project will simulate operations at the Department of
Motor Vehicles for customers renewing their driver’s license. This project is similar to the “barbershop”
example in the textbook.
The threads to be used are as follows:
Customer
1)
20 customers (1 thread each) all created at the start
of the simulation.
2)
Waits in line at Information Desk to get a number.
3)
Waits in waiting area until number is called.
4)
Waits in line for agent.
5)
Works with agent to complete driver’s license
application.
6)
Exits
Information Desk
1)
1 thread created at the beginning.
2)
Assigns a unique number sequentially starting at 1 to
each customer.
Announcer
1)
1 thread created at the beginning.
2)
Tries to keep agent line filled with 4 people.
Agent
1)
2 threads created at the beginning.
2)
Asks customer to take eye exam and photo.
3)
Provides customer with temporary license.
Main
1)
Creates and joins all customer threads. Customer threads may be joined in creation
order.
2)
When last customer has exited, ends the simulation.
Other rules:
1)
Each activity of each thread should be printed with
identification (e.g., customer 1).
2)
All mutual exclusion and coordination must be achieved
with semaphores.
3)
A thread may not use sleeping as a means of
coordination.
4)
Busy waiting (polling) is not allowed.
5)
Mutual exclusion should be kept to a minimum to allow
the most concurrency.
6)
The semaphore value may not obtained and used as a
basis for program logic.
7)
Each customer thread should print when it is created and
when it is joined.
8)
All activities of a thread should only be output by
that thread.
Output:
Your project’s output should match the wording and steps of
the sample output, although the order may vary.
Sample output for 2 agents and 4 customers:
Information desk created
Announcer created
Agent 0 created
Agent 1 created
Customer 1 created, enters DMV
Customer 1 gets number 0, enters
waiting room
Customer 0 created, enters DMV
Announcer calls number 0
Customer 2 created, enters DMV
Customer 0 gets number 1, enters
waiting room
Customer 1 moves to agent line
Customer 2 gets number 2, enters
waiting room
Announcer calls number 1
Announcer calls number 2
Customer 0 moves to agent line
Customer 2 moves to agent line
Agent 1 is serving customer 0
Agent 0 is serving customer 1
Customer 3 created, enters DMV
Customer 1 is being served by
agent 0
Agent 0 asks customer 1 to take
photo and eye exam
Customer 0 is being served by
agent 1
Customer 3 gets number 3, enters
waiting room
Agent 1 asks customer 0 to take
photo and eye exam
Customer 0 completes photo and eye
exam for agent 1
Agent 1 gives license to customer
0
Announcer calls number 3
Customer 0 gets license and
departs
Customer 0 was joined
Agent 1 is serving customer 2
Customer 1 completes photo and eye
exam for agent 0
Customer 3 moves to agent line
Customer 2 is being served by
agent 1
Agent 0 gives license to customer
1
Agent 1 asks customer 2 to take
photo and eye exam
Customer 1 gets license and
departs
Customer 2 completes photo and eye
exam for agent 1
Customer 1 was joined
Agent 0 is serving customer 3
Agent 1 gives license to customer
2
Customer 2 gets license and
departs
Customer 2 was joined
Customer 3 is being served by
agent 0
Agent 0 asks customer 3 to take
photo and eye exam
Customer 3 completes photo and eye
exam for agent 0
Agent 0 gives license to customer
3
Customer 3 gets license and
departs
Customer 3 was joined
Done
More information in the project_2 file