we have a shared lock variable which can take one of the two values, 0 or 1
Anonymous Quiz
89%
Test_and_set
11%
CompareAndSwap
The Test_and_Set takes a shared variable called offset that represent the lock status and return its
original value and then set the variable to true which means the lock is disabled
original value and then set the variable to true which means the lock is disabled
Anonymous Quiz
51%
T
49%
F
in Test_and_Set entry section
Anonymous Quiz
70%
while(test_and_set(&lock));
30%
while(test_and_set(&lock) == false)
in CompareAndSwap entry section
Anonymous Quiz
31%
while(compare_and_swap(&lock, 0, 1) == 0);
69%
while(compare_and_swap(&lock, 0, 1) != 0);
Simplest is mutex lock, boolean variable indicating if lock is available or not
Anonymous Quiz
88%
T
12%
F
in Mutex Locks Spinlocks is ideal for single-CPU as it is wasteful of CPU cycles that other process might be able to use productively
Anonymous Quiz
67%
F
33%
T
Derived Channel
Atomic =
semaphore S is an integer variable that can only be modified via two interruptible operations: wait () and signal ()
Anonymous Quiz
71%
T
29%
F
in semaphore wait function the value of the integer is
Anonymous Quiz
32%
incremented
68%
decremented
in semaphore signal function the value of the integer is
Anonymous Quiz
15%
decremented
85%
incremented
integer value can range only between 0 and 1
Anonymous Quiz
13%
Counting semaphore
87%
Binary semaphore
The main issue with semaphores is the busy loop in the signal() which eats CPU cycles without
accomplishing anything useful
accomplishing anything useful
Anonymous Quiz
56%
F
44%
T
semaphore implementation with no busy waiting there’s an associated waiting queue
Anonymous Quiz
71%
T
29%
F
remove one of processes in the waiting queue and place it in the ready queue
Anonymous Quiz
15%
block
85%
wakeup