diff --git a/l09/l09-handout.txt b/l09/l09-handout.txt index d9681e3..5c2fe47 100644 --- a/l09/l09-handout.txt +++ b/l09/l09-handout.txt @@ -218,8 +218,10 @@ the approaches that fall under the word "thread".) chewing up CPU cycles. Sometimes this is what we want (e.g., if the cost of going to sleep is greater than the cost of spinning for a few cycles waiting for another thread or process to - relinquish the CPU). But sometimes this is not at all what we - want (e.g., if the lock would be held for a while). + relinquish the spinlock). But sometimes this is not at all what we + want (e.g., if the lock would be held for a while: in those + cases, the CPU waiting for the lock would waste cycles spinning + instead of running some other thread or process). 5c. Here's a lock that does not involve busy waiting. Note: the "threads" here can be user-level threads, kernel threads, or @@ -229,7 +231,7 @@ the approaches that fall under the word "thread".) bool is_locked; /* true if locked */ thread_id owner; /* thread holding lock, if locked */ thread_list waiters; /* queue of thread TCBs */ - spinlock wait_lock; /* exactly as in 4b */ + spinlock wait_lock; /* exactly as in 5b */ } Now, mutex.acquire() looks something like this: @@ -242,7 +244,7 @@ the approaches that fall under the word "thread".) wait_lock.acquire(); } is_locked = 1; - owner.self; + owner = self; wait_lock.release(); And mutex.release() looks something like this: