Question: In the thread-local variables sidebar, we described how many thread systems have this type of per-thread state. Describe how you would implement thread-local variables. Each
In the thread-local variables sidebar, we described how many thread systems have this type of per-thread state.
Describe how you would implement thread-local variables. Each thread should have an array of 1024 pointers to its thread-local variables.
A. What would you add to the TCB?
B. How would you change the thread creation procedure? (For simplicity, assume that
when a thread is created, all 1024 entries should be initialized to NULL)
C. How would a running thread allocate a new thread-local variable?
D. In your design, how would a running thread access a particular thread-local variable?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
