Question: Operating Systems Please answer with full steps written and explaination: Broken lock: void SpinLock(volatile unsigned int *lock) { while (*lock == 1) // TEST (lock)
Operating Systems
Please answer with full steps written and explaination:
Broken lock:
void SpinLock(volatile unsigned int *lock) {
while (*lock == 1) // TEST (lock) ; // spin
*lock = 1; // SET (lock)
}
void SpinUnlock(volatile unsigned int *lock) {
*lock = 0;
}
Fill in the rest of the timeline with an example showing the lock is broken:
Thread 1 Thread 2
--------------------------------------------------
while (*lock == 1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
