Page 121 - DCAP103_Principle of operating system
P. 121
Principles of Operating Systems
Notes choosing[i] := false;
for j := 0 to n 1
do begin
while choosing[j] do no-op;
while number[j] =6 0
and (number[j],j) < (number[i], i) do no-op;
end;
critical section
number[i] := 0;
remainder section
until false;
Synchronization Hardware
Test and modify the content of a word atomically.
function Test-and-Set (var target: Boolean): Boolean;
begin
Test-and-Set := target;
target := true;
end;
Mutual Exclusion with Test-and-Set
Shared data: var lock: Boolean (initially false)
Process Pi
repeat
while Test-and-Set(lock) do no-op;
critical section
lock := false;
remainder section
until false;
Explain steps of Bakery Algorithm.
Self Assessment
Multiple choice questions:
1. Which of the following are(is) Language Processor(s)?
( a) Assembles (b) Compilers
( c) Interpreters (d) All of the above
114 LOVELY PROFESSIONAL UNIVERSITY