EECS 343: Homework 3

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (4 votes)

Threads and Synchronization
1. In class we listed the register set as a per-thread rather than per-process item. Why? After all, the machine
has only one set of registers.
2. If a multithreaded process forks, a problem occurs if the child gets copies of all the parent’s threads. Suppose
that one of the original threads was waiting For keyboard input. Now two threads are waiting for keyboard
input, one in each process. Does this problem ever occur in single-threaded processes?
3. Can two threads in the same process synchronize using a kernel semaphore if the threads are implemented
by the kernel? What if they are implemented in user space? Assume that no threads in any other processes
have access to the semaphores.
4. Show how counting semaphores can be implemented using only binary semaphores and ordinary machine
instructions.
5. Consider a system in which threads are implemented entirely in user space, with the run-time system getting
a clock interrupt once a second. Suppose that a clock interrupt occurs while some thread is executing in
the run-time system. What problem might occur? Can you suggest a way to solve it?
1