scheduling algorithm and analysis
play

Scheduling Algorithm and Analysis RT Synchronization Protocol - PowerPoint PPT Presentation

Scheduling Algorithm and Analysis RT Synchronization Protocol (Module 34) Yann-Hang Lee Arizona State University yhlee@asu.edu (480) 727-7507 Summer 2014 Real-time Systems Lab, Computer Science and Engineering, ASU Properties of Priority


  1. Scheduling Algorithm and Analysis RT Synchronization Protocol (Module 34) Yann-Hang Lee Arizona State University yhlee@asu.edu (480) 727-7507 Summer 2014 Real-time Systems Lab, Computer Science and Engineering, ASU

  2. Properties of Priority Inheritance  For each resource (semaphore), a list of blocked tasks must be stored in a priority queue.  A task (job) τ i uses its assigned priority, and uses (inherits) the highest dynamic priority of all the tasks it blocks when it is in its critical section and blocks some higher priority tasks.  Priority inheritance is transitive ; that is, if task τ i blocks τ j and τ j blocks τ k , then τ i can inherit the priority of τ k .  When task τ i releases a resource, which priority it should use?  Chained blocking if requesting multiple resources (nested mutex requests)  Direct blocking and indirect (inheritance) blocking (when the lower priority task inherits the higher priority task’s priority). 1 Real-time Systems Lab, Computer Science and Engineering, ASU

  3. Implementation Issues of BIP  PI semaphore and basic semaphore  Priority is changed when acquiring and releasing a lock  When release a lock, can the priority be restore to the one before acquiring?  Need to maintain a list of PI semaphores locked by a task  when holding multiple locks and release one  when a PI semaphore is deleted  when a task waiting for a PI semaphore quits the waiting (due to timeout)  when the priority of a task waiting for a PI semaphore is changed  Note that for each semaphore, a queue for all waiting tasks 2 Real-time Systems Lab, Computer Science and Engineering, ASU

  4. Example Of Chained Blocking (BIP) τ 1 :{…P(S1)…P(S2)…V(S2)…V(S1)…} τ 2 :{…P(S1)…V(S1)…} τ 3 :{…P(S2)…V(S2)…} Attempts to lock Attempts to lock S2(blocked) S1(blocked) τ 1 (H) B B B S1 locked S1 unlocked τ 2 (M) S2 unlocked S2 locked τ 3 (L) 3 Real-time Systems Lab, Computer Science and Engineering, ASU

  5. Deadlock: Using BIP τ 1 :{…P(S1)…P(S2)…V(S2)…V(S1)..} τ 2 :{…P(S2)…P(S1)…V(S1)…V(S2)..} Attempts to lock S2 (blocked) Locks S1 τ 1 (H) B Attempts to lock S2 locked S1 (blocked) τ 2 (M) 4 Real-time Systems Lab, Computer Science and Engineering, ASU

  6. Blocking Time Under BIP  Example T1 = {.. P(A) .3. P(B) .2. V(B) .1. V(A) ..} T2 = {.. P(C) .2. V(C) ..} T3 = {.. P(A) .1. P(B) .2. V(B) .2. V(A) .. } T4 = {.. P(A) .1. P(C) .1. P(B) .3. V(B) .1. V(C) .1. V(A).. } indirect blocking direct blocking by blocking time by T2 T3 T4 T2 T3 T4 T2 T3 T4 T1 N Y Y 5 7 T2 N Y Y Y 5 7 T3 Y Y 7 5 Real-time Systems Lab, Computer Science and Engineering, ASU

  7. Priority Ceiling Protocol (PCP) τ 2 :{…P(S1)…V(S1)…} τ 3 :{…P(S2)…V(S2)…} τ 4 :{…P(S1)…V(S1)…} τ 1 (H) attempts to S1 ready S1 unlocked lock S1 locked B τ 2 attempts S2 locked ready to lock S2 τ 3 blocked S1 locked S1 unlocked by ceiling τ 4 (L) 6 Real-time Systems Lab, Computer Science and Engineering, ASU

  8. Basic Priority Ceiling Rules (1)  Π (R) = priority ceiling of resource R – the highest priority of the tasks that request R  Π S (t) = system priority ceiling -- the highest priority ceiling of the resources that are in use at time t  Scheduling Rule: same as the assumptions  Allocation Rule :  if J i → R k → J l at t = t 1 then block J i (no change)  R k free at t 1 ,  if π i ( t 1 ) > Π S (t 1 ), then R k → J i  else (i.e. π i ( t 1 ) ≤ Π S (t 1 ) ) if for some R x → J i and Π (R x ) = Π S (t 1 ), then R k → J i [ J i holds a resource R x whose priority ceiling is Π S (t 1 ) ]  else deny and block ( J i → R k ) 7 Real-time Systems Lab, Computer Science and Engineering, ASU

  9. Basic Priority Ceiling Rules (2)  Priority-Inheritance Rule:  if J i → R k at t = t 1 and is blocked by J l ( and π l (t 1 - ) = priority of J l )  either R k → J l , ( J l holds the resource R k ) or J l → R x and Π (R x ) = Π S (t 1 ) ≥ π i ( t 1 )  then π l (t 1 + ) = π i (t 1 ) ( inherited priority )  until J l releases all R x with Π (R x ) ≥ π i ( t 1 ) , π l (t 2 + ) = π l (t 1 - ) at t = t 2 . 8 Real-time Systems Lab, Computer Science and Engineering, ASU

  10. Supplementary Slides Real-time Systems Lab, Computer Science and Engineering, ASU

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend