1 / 25

Chapter 7 - Resource Access Protocols (Critical Sections)

Chapter 7 - Resource Access Protocols (Critical Sections). Protocols: No Preemptions During Critical Sections Once a job enters a critical section, it cannot be preempted until it finishes the critical section Priority Inheritance Protocol (for static scheduled systems)

yardley-kim
Download Presentation

Chapter 7 - Resource Access Protocols (Critical Sections)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 7 - Resource Access Protocols (Critical Sections) Protocols: No Preemptions During Critical Sections Once a job enters a critical section, it cannot be preempted until it finishes the critical section Priority Inheritance Protocol (for static scheduled systems) A job that is blocking a high priority job that seek the critical section, has its priority elevated to cause it to finish using the critical section Priority Ceiling Protocol (for static scheduled system) Jobs are not allowed to enter a critical section if there are jobs that can block it. Stack Resource Policy (for static or dynamic scheduled systems) A job that needs a resource that is not available, is blocked at the time it attempts to preempt, instead of at the later time when it would request the resource

  2. Definitions Resource Types – private, shared, mutually exclusive Critical Sections – code executed under mutual exclusion: At most one task can be holding the resource at a given time. All other tasks ready to use the resources are “blocked” Semaphores - Resource Rk  Semaphore Sk A critical section operating on Rk Begins with a wait(Sk) End with a signal(Sk)

  3. Critical Sections

  4. Implications Implications of Critical Sections: Protocols must include max delays due to potential blocking in worst-case computation times when scheduling.  Leads to necessity for very conservative scheduling to guarantee not missing deadlines.

  5. Blocking

  6. Chained Blocking

  7. Priority Inversion

  8. Deadlock

  9. Denying Preemptions during Critical Sections Denying preemption during execution of a critical section eliminates priority inversion.  Leads to unnecessary blocking (delay) of higher priority tasks.

  10. Priority Inheritance Protocol(applicable for fixed priority scheduling – think Rate Monotonic)

  11. Priority Inheritance Protocol

  12. Priority Inheritance Protocol

  13. Priority Inheritance Protocol

  14. Some Properties: Priority Inheritance Protocol

  15. Priority Ceiling Protocol(applicable for fixed priority scheduling – again think Rate Monotonic)

  16. Priority Ceiling Protocol

  17. Priority Ceiling Protocol Some Properties:

  18. Stack Resource Policy(applicable for fixed or dynamic scheduling – think Rate Monotonic or Earliest Deadline First) Each task has: A priority pi (assigned either statically or dynamically), pa > pb means execution of ta is more important thantb A preemption level pi (assigned statically) pa > pb   Da < Db (relative deadlines) Ja can preempt Jb ONLY IF pa > pb Preemption levels are static and are used to predict potential blocking in

  19. Definitions (Current Ceilings): Denotes the number of units of R that are currently available Stack Resource Policy Denotes the maximum requirement of job J for R Current Resource Ceiling (computed as a function of the units of R that are available): i.e., the highest preemption level of those jobs that could be blocked on R System Ceiling (the maximum of the current ceilings of all of the resources): Ps = max{CR1 : I= 1,2,…,m) i.e., the maximum of the Current Resource Ceilings

  20. Stack Resource Policy Protocol: A job is not allowed to preempt until: its priority is the highest among those jobs ready to run, and its preemption level is higher than the system ceiling

  21. Stack Resource Policy

  22. Given: (J1 J2 J3) that share (R1 R2 R3) where: R1 consists of 3 units,R2 of 1, R3 of 3 , and Stack Resource Policy Example = units available, = maximum requirement for the job CR1(3) = max { 0 } = 0 CR1(2) = max {p (J3) } = max {1} = 1 CR1(1) = max {p (J2), p (J3) } = max { 2, 1} = 2 CR1(0) = max {p (J1), p (J2), p (J3) } = max { 3, 2, 1} = 3

  23. Protocol: A job is not allowed to preempt until: its priority is the highest among those jobs ready to run, its preemption level is higher than the system ceiling Stack Resource Policy Example t0 : J3 begins executing and the system ceiling = 0 because all resources are completely available. When J3 enters its first critical section, it takes the unit of R2 . The ceiling is set to the highest preemption level among the tasks that could be blocked on R2 ; that is Ps = p2 = 2. As a consequence, J2 is blocked by the preemption test and J3 continues to execute. t1 : When J3 enters its nested critical section, taking all units of R1 , the system ceiling is raised to Ps = p1 = 3 . This causes J1 to be blocked by the preemption test. t2 : As J3 releases R1 , the system ceiling becomes Ps = p2 = 2 (the highest preemption level among tasks that could be blocked on R2 ; thus J1 preempts J3 and starts executing. Once J1 is started, it is never blocked during its execution because the condition p1 < Ps guarantees that all the resources needed by J1 are available. As J1 terminates, J3 resumes execution and releases resource R2 . t3 : As R2 is released, the system ceiling returns to zero and J2 can preempt J3 . Again, once J2 is started, all the resources it needs are available; thus J2 is never blocked.

  24. Properties: Stack Resource Policy

  25. The End

More Related