Upload
marquis-parkinson
View
218
Download
1
Tags:
Embed Size (px)
Citation preview
LUI SHA ,RAGUNATHAN RAJKUMAR ,JOHN P.LEHOCZKYIEEE TRANSACTIONS ON COMPUTERS, VOL. 39, NO. 9,
SEPTEMBER 1990Repesent : Shu Wei Ho
Motivation Simple solution Basic priority inheritance protocol(BIP) Deadlock Chain blocking Priority ceiling protocol(PCP) Conclusion
Data Synchronization
Ex.
Critical section(nonpreempt)
Ex.
Chain blocking
PCP
t0 : J0 -> X J1 -> X J2 -> P2 (exe)
t1 : J0 -> X J1 -> P1 (exe) J2 -> P2
ta : J0 -> X J1 -> P1 (exe) J2 -> P2
t2 : J0 -> P0 (exe) J1 -> P1 J2 -> P2
t3 : J0 -> blocked by J2(S1) J1 -> P1 J2 -> P2 -> inherit -> P0 (exe)
t4 : J0 -> P0 (exe) J1 -> P1 J2 -> P0 -> P2
t5 : J0 -> blocked by J1(S2) J1 -> P1-> inherit -> P0 (exe) J2 -> P2
t6 : J0 -> P0 (exe) J1 -> P0 -> P1 J2 -> P2
t7 : J0 -> X J1 -> P1 (exe) J2 -> P2
t8 : J0 -> X J1 -> X J2 -> P2 (exe)
..
PCP
'Thread 1 SyncLock LeftVal SyncLock RightVal 'Perform operations on LeftVal and RightVal that require read and write. End SyncLock End SyncLock
'Thread 2 SyncLock RightVal SyncLock LeftVal 'Perform operations on RightVal and LeftVal that require read and write. End SyncLock
End SyncLock
Set priority to each critical section
Use S0-> J0(H)-> priority of S0 = P0(J0) S1-> J2 J1(H)-> priority of S1= P1(J1) S2-> J2 J1(H)-> priority of S2= P1(J1)
Terminology◦ Task priority ( Jn -> Pn)◦ Resource Ceiling /System Ceiling (SC)◦ Inheritance Priority
Protocol◦ Priority driven scheduling◦ Lock/Unlock◦ Block/Unblock
t0 : J0 -> X J1 -> X J2 -> P2 (exe) SC -> Lowest
ta : J0 -> X J1 -> X J2 -> P2(attempt to lock S2)>SC (Lowest)(exe) SC -> Lowest->(P1, J2(S2))
t1 : J0 -> X J1 -> P1 (preempt) (exe) J2 -> P2 SC -> (P1, J2(S2))
t2 : J0 -> X J1 -> P1 (attempt to lock S2)≯SC(P1) J2 -> P2->inherit->P1 (exe) SC ->(P1, J2(S2))
t3 : J0 -> X J1 -> P1 J2 ->(attempt to lock S1)P1≯SC(P1) but self (exe) SC -> (P1, J2(S2))
t4 : J0 -> P0(preempt) (exe) J1 -> P1 J2 -> P1 SC -> (P0, J2(S1))
t5 : J0 -> (attempt to lock S0) P0≯SC(P0) J1 -> P1 J2 -> P1->inherit J0 -> P0 (exe) SC -> (P0, J2(S1))
t6 : J0 -> (attempt to lock S0) P0>SC(P1) (exe) J1 -> P1 J2 -> P1 SC -> (P0, J2(S1))->(P1, J2(S2))->(P0, J0(S0))
tb : J0 -> (attempt to lock S1) P0 >SC(P1) (exe) J1 -> P1 J2 -> P1 SC -> (P1, J2(S2))->(P0, J1(S1))
t7 : J0 -> end J1 -> P1( attempt to lock S2)≯SC(P1) J2 -> P1 (exe) SC -> (P1, J2(S2))
t8 : J0 -> end J1 -> P1(attempt to lock S2)>SC(lowest) (exe) J2 -> P2 SC -> (P1, J2(S2))->Lowest -> (P1, J1(S2))
t9 : J0 -> end J1 -> end J2 -> P2 (exe) SC -> Lowest
Priority of S0 = P0 S1 = P1 S2 = P1
..
Deal with deadlock
BIP
Deal with chain blocking
BIP
ta : J0 -> X J1 -> (attempt to lock S2)P1< SC(P0) J2 -> J2 -> inherit -> P1 (exe) SC -> (P0, J2(S1))
It showed that both protocols solve the uncontrolled priority inversion problem.
In particular, the priority ceiling protocol prevents deadlocks and reduces the
blocking to at most one critical section.