










Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Some concept of High Performance Computing are Addressing Modes, Program Execution, Basic Computer Organization, Control Hazard Solutions, Least Recently Used, Memory Hierarchy Progression. Main points of this lecture are: Implementing a Lock, Acquirelock, Releaselock, Fails, Processes, Available, Lock Implementation, Set Instruction, Atomically, Indivisibly
Typology: Slides
1 / 18
This page cannot be seen from the preview
Don't miss anything!











2
4
wait: LW R1, Addr(L) BNEZ R1, wait ADDI R1, R0, 1 SW R1, Addr(L) Process 1 Process 2 LW R1 = 0 LW R1 = 0 BNEZ ADDI SW Enter CS BNEZ ADDI SW Enter CS time Assume that lock L is currently available (L = 0) and that 2 processes, P1 and P2 try to acquire the lock L CSwitch CSwitch IMPLEMENTATION ALLOWS PROCESSES P1 and P2 TO BE IN CRITICAL SECTION TOGETHER!
5
while ( L == 1) ; L = 1; wait: LW R1, Addr(L) BNEZ R1, wait ADDI R1, R0, 1 SW R1, Addr(L)
7
8
while(Test&Set(L)); while(Test&Set(L)); while(Test&Set(L)); Critical Section Critical Section Critical Section L=0; L=0; L = 0; Suppose that process P1 is in its Critical Section. Processes P2 and P3 are trying to Acquire the Lock in order to enter their Critical Sections
10
while(Test&Set(L)); while(Test&Set(L)); while(Test&Set(L)); Critical Section Critical Section Critical Section L=0; L=0; L = 0;
11
13
14
if (S != 0) S--; return / S== else block process until S!= S--; return / S== S++ / S== Unblock a process blocked on S
16
if (S != 0) S--; return else block process until S!= S--; return S++ Unblock a process blocked on S
17
10 processes will be allowed to proceed Processes beyond that will be blocked until one of the first 10 executes V(S)