Use all the information given below to answer the Lab Question by making sure all the requirements
Question:
Use all the information given below to answer the Lab Question by making sure all the requirements are fulfilled:
Requirements for the lab:
- source code
- Makefile if needed
- brief report as a PDF or TXT file explaining your (a) program and its output, (b) your approach to notify selected threads, and (c) the compilation process.
- Should include:
- the correct number of threads are spawned
- threads can block with a deadline
- the thread selected can be unblocked before its deadline
- the report is clear and complete
Lab Question:
Starting from the waker/sleeper source code developed in Section 2.1.3, extend its functions so that the following features are available:
a) There are two sleeper threads.
b) The waker can randomly choose to wake one of the sleeper threads or the other. The other thread’s waiting period expires.
c) Output messages should clarify which operations are carried out by threads and by which threads. In particular, you should assign an ID to each of the sleeper threads, for example, by passing the ID as an argument to its function.
d) Explain your approach in a short PDF report: are you using different condition vari- ables? Are you using the same condition variable? Justify your choices.
Codes given to us:
1.notify.cc
2. sleeper.cc
3. threads.cc
Lab Description:
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill