|
ADOS: ASSIGNMENT 2
|
There are two questions in this assignment. Answer both of them.
Submission Instructions:
- Programs should be in individual files named according to the
question numbers.
- Explanations should be in either a single PDF or
.docx file
- Tar all the files, compress it and create a single tgz file
with your Roll Number as the filename
- Email the compressed tar file to chakcs@dcis.uohyd.ernet.in
Email to any other address is not allowed.
- Email subject line MUST include the phrase ADOS ASSIGNMENT-2
QUESTIONS
- A bank has three entrances and eight counters. Each entrance
has a token issuing machine next to it. A customer
enters or exits the bank through any of the entrances.
He/she then collects a token and waits for the token number
to be 'called' by any counter. The calling of a token
is taken to mean that the customer finishes his/her job and
exits from the bank.
It must be ensured that:
- Tokens must be issued in strict sequence.
- No token number must be skipped or issued twice.
- Counters should call the tokens in a strict
ascending order.
- No token should be skipped or called twice.
- No counter can call a token number that has not been
issued at that time.
Write a program that uses multiple threads for the token
issuing machines and counters with appropriate synchronisation
primitives. Describe your data structures with diagrams,
and choice of synchronization primitives with justification.
- Implement the program given in sample code "Linear Buffer
Example" on 9 September in the course webpage using
named semaphores.
REMEMBER THE ASSIGNMENT IS DUE ON 30 SEPTEMBER 2014