Slide 1

Slide 1 text

Priority Ceiling Protocol Konstantinos Goutsos EEE8068: Real-Time Computer Systems School of Electrical and Electronic Engineering Newcastle University 1 April 2015

Slide 2

Slide 2 text

Presentation Outline •Introduction • Resources: Shared and Exclusive • Semaphores and Critical Sections • Task blocking and Deadlocks •Priority Inversion Phenomenon •Priority Inheritance Protocol •Priority Ceiling Protocol • Justification • Definition • Example 2 April 2015

Slide 3

Slide 3 text

Resources • Software structures used by processes • Shared resources: can be used by multiple processes • Exclusive resources: protected against simultaneous use by more than one process using critical sections 3 April 2015

Slide 4

Slide 4 text

Critical Sections • Task sections which should not be interrupted • Used to control access to exclusive resources • Usually implemented with semaphores • Semaphores: provided by the OS, bound to an exclusive resource • Semaphores can be used only by the wait and signal primitives 4 April 2015

Slide 5

Slide 5 text

Task blocking and Deadlocks • A task can stay in a waiting state: task blocking • The maximum blocking time is very important for real- time systems • Deadlock: a situation where two or more tasks are waiting for each other to complete 5 April 2015

Slide 6

Slide 6 text

Priority Inversion Phenomenon • Appears when using preemption and critical sections • A high priority task has to wait for a lower priority one to exit a critical section in order to enter its own • Happens when a low priority task has entered its critical section first • May create unbounded blocking as the waiting time depends on the execution time of lower priority tasks 6 April 2015

Slide 7

Slide 7 text

Priority Inversion Phenomenon: Example 7 April 2015 [Buttazzo 2011]

Slide 8

Slide 8 text

Priority Inversion Phenomenon: Example 8 April 2015 [Buttazzo 2011] 1 > 2 > 3

Slide 9

Slide 9 text

Dealing with the Phenomenon • Simple solution: Disable preemption during critical sections • Complex priority protocols • Static priorities: Priority Inheritance, Priority Ceiling • Static & dynamic priorities: Stack Resource Policy 9 April 2015

Slide 10

Slide 10 text

Priority Inheritance Protocol • A task causing blocking temporarily assumes the priority of the blocked task • Plus: Bounds the maximum blocking time (which can be calculated) • Minus: Blocking time is not reduced and deadlocks are not prevented 10 April 2015

Slide 11

Slide 11 text

Priority Ceiling Protocol • Builds on the Priority Inheritance Protocol • Adds a rule for granting lock requests on semaphores: Each semaphore is assigned a priority ceiling • The ceiling is equal to the priority of the highest priority job that can lock the semaphore • A task can only lock a semaphore if its priority is higher than the larger priority ceiling among all locked semaphores • Makes sure that once a job enters a critical section it cannot be blocked by lower priority jobs 11 April 2015

Slide 12

Slide 12 text

Priority Ceiling Protocol: Example 12 April 2015 [Buttazzo 2011] 1 > 2 > 3

Slide 13

Slide 13 text

References G. C. Buttazzo, Hard Real-time Computing Systems: Predictable Scheduling Algorithms and Applications. 2011. April 2015 13