UTSA CS 4953 Special Studies in Computer Science:
Advanced Topics in Concurrency and Communication Fall 2003
Midterm Exam Comments
Important note:
If it says redo on your exam, you must follow the
directions at the bottom of this page.
- Note that a pthread_t is not necessarily an integer,
so you cannot store 0 in it.
- When you wake up from the pthread_cond_wait
there are three possibilities:
- no threads have finished since the last time you awoke.
- exactly one thread will have finished since the last time you awoke.
- many threads have finished since the last time you awoke.
- There is no need to join the threads if you detach them.
In this case you know which has finished without having to do a join.
- You must avoid busy-waiting.
- Ideally, the copyfilepass threads should not have to know
how many threads there are.
- General idea:
- copymultiple has an array of done flags.
- Each thread has access to its done flag and sets it to 1 and wakes
up copymultiple.
- When copymultiple wakes up, it processes and clears all
of the done flags, keeping a count of the total number processed.
If it said redo on your exam:
- Rewrite any answers to the parts of problem 1 that need to be redone.
- Turn in source code for your revised copies of Programs 12.7 and 12.8.
Turn in complete programs for each.
Start with the code from the book and edit the files appropriately.
What you turn in must be free of syntax errors and compile correctly.
- Also return your original test answers.
- Turn this in by Tuesday, October 28.