Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 116

Resource

Access
Control

K i z h e p p a t t Vi p i n
Resources
In addition to a processor, jobs require other resource(s) to execute
 mutexes, files, connection sockets, printers, sequence numbers

We assume uniprocessor systems

System also contains ρ types of serially reusable resources named R1, R2, . . . , Rρ

There are νi indistinguishable units of resource (of type) Ri

Resources are allocated to jobs on a nonpreemptive basis and used in a mutually


exclusive manner
 Note resources are nonpreemptive, but jobs might be

When a unit of a resource Ri is granted to a job, this unit is no longer available to


other jobs until the job frees the unit
Resources
Plentiful resources will not be used in modelling

If a resource can be used by more than one job at a time (eg: file read) it is
modelled as a resource type that has many units, each used in a mutually exclusive
manner

When a job wants to use ηi units of resource Ri, it executes a lock to request them
denoted by L(Ri, ηi)

When the job no longer needs the resource, it releases the resource by executing an
unlock, denoted by U(Ri, ηi)

When Ri has only 1 unit, use the simpler notations L(Ri) and U(Ri)
Critical Section
A segment of a job that begins at a lock and ends at a matching unlock a critical
section

Resources are released in the last-in-first-out order


Critical Section
A critical section that is not included in other critical sections is an outermost
critical section

Each critical section is denoted by [R, η; e]

If only one unit of resource [R; e] [R3;10]

[R4,3;9]
Critical Section
Combination of critical sections can be indicated by nesting the square brackets

[R3;10 [R2; 5]]

[R2;7 [R3; 2]] [R3;3]

[R1;14 [R4,3;9[R5,4;3]]]
Resource Conflicts and Blocking
Two jobs conflict with one another, or have a resource conflict, if some of the
resources they require are of the same type

The scheduler always denies a request if there are not enough


free units of the resource to satisfy the request

When a job’s lock request fails the job is blocked

It stays blocked until the scheduler grants it the requested resource


Resource Conflicts and Blocking
J1  feasible interval (6, 14] Critical section [R; 2] after 2 units from release e = 5
J2  feasible interval (2, 17] Critical section [R; 4] after 2 units from release e = 7
J3  feasible interval (0, 18] Critical section [R; 4] after 1 unit from release e = 6
Only 1 unit of R is available to the system
Scheduled with EDF
Effects of Resource Contention/Conflict
Priority inversion
Because resources are allocated to jobs on a nonpreemptive basis, a higher-priority
job can be blocked by a lower-priority job

Priority inversion can cause timing anomaly


Timing Anomaly
J1  feasible interval (6, 14] Critical section [R; 2] after 2 units from release
J2  feasible interval (2, 17] Critical section [R; 4] after 2 units from release
J3  feasible interval (0, 18] Critical section [R; 2.5] after 1 units from release

J1 didn’t meet deadline


Scheduled with EDF
Uncontrolled Priority Inversion
Priority inversion can be unbound also

J2 has higher priority than J3 but doesn’t require


the resource required by J1 and J3
Effects of Resource Contention/Conflict
Deadlock

Suppose there are two jobs that both require resources X and Y

The jobs are in deadlock when one of them holds X and requests for Y, while the
other holds Y and requests for X
Resource Access Control
To avoid the issues related to resource conflict, we need some kind of resource
access control

A resource access-control protocol (access-control protocol) is a set of rules that


govern

a) when and under what conditions each request for resource is granted

b) how jobs requiring resources are scheduled


NPCS Protocol
Schedule the critical portion of the job non-preemptively  Nonpreemptive
Critical Section (NPCS) protocol

When a resource is requested, job will immediately get it

When a job holds any resource, it executes at a priority higher than


the priorities of all jobs

It is deadlock free
NPCS Protocol
Priority inversion can happen but no uncontrolled priority inversion

A high priority job will be blocked by a low priority job at most once

blocking time bi(rc) due to resource conflict of a periodic task Ti in a fixed-priority


system of n periodic tasks is equal to

bi(rc) = max(ck)
i+1≤k≤n
NPCS Advantages
Simplicity

Protocol does not need any prior knowledge about resource requirements of jobs

Support arbitrary number of resources

Can be used in fixed priority or dynamic priority systems

Very effective when critical sections are short


NPCS Disadvantages
Every job can be blocked by any low-priority job that require any resource even if
there is no resource conflict

When the resource requirements of all jobs are known, an improvement is to let a
job holding any resource execute at the highest priority of all jobs requiring that
resource
Basic Priority Inheritance Protocol
Works with any preemptive, priority driven scheduling algorithm

Does not require prior knowledge of resource requirements of job

Does not prevent deadlock

We assume that there is only one unit of each resource  basic priority inheritance
Basic Priority Inheritance Protocol
Assigned priority  Priority of the job assigned using scheduling algorithm

current priority  Priority at which the job executing at time t

The current priority πl(t) of a job Jl may be raised to the higher priority πh(t) of
another job Jh temporarily

Lower-priority job Jl inherits the priority of the higher priority job Jh and that Jl
executes at its inherited priority πh(t)
Rules of the Basic Priority-Inheritance Protocol
1. Scheduling Rule:

Ready jobs are scheduled on the processor preemptively in a priority driven manner
according to their current priorities

At its release time t , the current priority π(t) of every job J is equal to its assigned
priority

The job remains at this priority except under the condition stated in rule 3
Rules of the Basic Priority-Inheritance Protocol
2. Allocation Rule:

When a job J requests a resource R at time t,


(a) if R is free, R is allocated to J until J releases the resource, and
(b) if R is not free, the request is denied, and J is blocked

3. Priority-Inheritance Rule:
When the requesting job J becomes blocked, the job Jl which blocks J inherits the
current priority π(t) of J
The job Jl executes at its inherited priority π(t) until it releases R; at that time, the
priority of Jl returns to its priority πl(t’) at the time t’ when it acquires the resource
R
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1
J2 is blocked by J5. J5. inherits the priority of J2

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1
J1 is blocked by J4. J4 inherits the priority of J1

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1
J4 is blocked by J5. J5 inherits the current priority of J4

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1
J5 releases the resource. So priority goes back to the priority at time 1

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1
J4 releases the resource. So priority goes back to the priority at time 11

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1
J4 releases the resource. Remember [R1;4] is the total time for which resource R1
is held
J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example
Job ri ei πi Critical Sections
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s = 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1

J2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Basic Priority Ceiling Protocol
Extends the priority-inheritance protocol to prevent deadlocks and to reduce the
blocking time

Assumptions

The assigned priorities of all jobs are fixed

The resources required by all jobs are known a priori before the execution of any
job begins

Terminology

Priority ceiling of resource: The highest assigned priority among all the jobs that
require Ri and is denoted by (Ri)
Basic Priority Ceiling Protocol
Terminology

Current priority ceiling (or simply the ceiling) (t) of theˆsystem:


Equal to the highest priority ceiling of the resources that are in use at the time

If all resources are free, then , a non-existing priority level that is lower than the
lowest priority of all jobs
Rules of Basic Priority-Ceiling Protocol
1. Scheduling Rule:
(a) At its release time t , the current priority π(t) of every job J is equal to its
assigned priority

The job remains at this priority except under the condition stated in rule 3.

(b) Every ready job J is scheduled preemptively and in a priority-driven manner at


its current priority π(t)
Rules of Basic Priority-Ceiling Protocol
2. Allocation Rule:

Whenever a job J requests a resource R at time t, one of the following


two conditions occurs:

(a) R is held by another job. J’s request fails and J becomes blocked

(b) R is free

(i) If J ’s current priority π(t) is higher than the current priority ceiling (t), R
is allocated to J
ˆ
(ii) else R is allocated to J only if J is the job holding the resource(s) whose
priority ceiling is equal to (t), otherwise, J ’s request is denied, and J
becomes blocked. ˆ
Rules of Basic Priority-Ceiling Protocol
2. Priority-Inheritance Rule:

When J becomes blocked, the job Jl which blocks J inherits the current priority π(t)
of J

Jl executes at its inherited priority

When it releases every resource whose priority ceiling is equal to or higher than π(t),
priority of Jl returns to its priority πl(t’) at the time t’ when it was granted the
resource(s).
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
Requests for R1.R1 is free but ceiling is 2 and J4 is not
J2 5 3 2 [R2;1] C1s = 1
J1 holding that resource. So blocked
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J5 inherits priority of J4
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J5 inherits priority of J2
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J5 priority back to 5 J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 5 3 2 [R2;1] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s =
J2
1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Deadlock Avoidance by Priority-Ceiling Protocol
Priority ceiling protocol becomes deadlock free due to the 2 allocation rules

At any time t , the priority π(t) of a job J being higher than the current ceiling (t) of
the system 
a) J will not requireˆ any of the resources in use at t ever
b) jobs with priorities equal to or higher than J will not require any of these
resource at t ever
Under this case if J requests for a free resource, it can be allocated to J since J will
never be blocked for any of the currently used resources (Allocation rule b(i))

If J is already holding the resource, it will be allowed to use it otherwise it will lead
to deadlock (Allocation rule b(ii))
(t) tells us the set of jobs to which free resources can be allocated safely

ˆ
STACK-BASED, PRIORITY-CEILING/CEILING-PRIORITY PROTOCOL
Simpler than the priority ceiling protocol but has the same worst-case performance

A resource in the system is the run-time stack

1. Scheduling Rule: After a job is released, it is blocked from starting execution until
its assigned priority is higher than the current ceiling (t) of the system

ˆ jobs that are not blocked are scheduled on the processor in a


At all times,
priority-driven, preemptive manner according to their assigned priorities

2. Allocation Rule: Whenever a job requests a resource, it is allocated the resource


Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 4.8 3 2 [R2;1.2] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s
J2
= 1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 4.8 3 2 [R2;1.2] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s
J2
= 1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
J4 is released but its assigned priority is less than current b
system priority ceiling. So not allowed to start J1 7 3 1 [R1;1] C1s = 1
J2 4.8 3 2 [R2;1.2] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s
J2
= 1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 4.8 3 2 [R2;1.2] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s
J2
= 1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 4.8 3 2 [R2;1.2] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s
J2
= 1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 4.8 3 2 [R2;1.2] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s
J2
= 1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 4.8 3 2 [R2;1.2] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s
J2
= 1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 4.8 3 2 [R2;1.2] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s
J2
= 1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 4.8 3 2 [R2;1.2] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s
J2
= 1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 4.8 3 2 [R2;1.2] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s
J2
= 1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 4.8 3 2 [R2;1.2] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s
J2
= 1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1;1] C1s = 1
J2 4.8 3 2 [R2;1.2] C1s = 1
J1
J3 4 2 3
J4 2 6 4 [R1;4[R2;1.5] ] C1s
J2
= 1, C2s = 3
J3 J5 0 6 5 [R2;4] C1s = 1

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 1
6 5 4 3
Basic Priority Ceiling in Dynamic Systems
In dynamic systems (such as EDF) priorities of tasks are not fixed

So update the priority ceilings of all resources whenever a new job is released

Eg: T1 = (0.5, 2.0, 0.2; [R1; 0.2]), T2 = (3.0, 1.5; [R2;0.7]), and T3 = (5.0, 1.2; [R1; 1.0 [R2;
0.4])
Example Task фi p i ei πi Critical Sections
T1 0.5 2 0.2 - [R1;0.2] C1s = 0
T1 T2 0 3 1.5 1 [R2;0.7] C1s = 0.3
T2 T3 0 5 1.2 2 [R1; 1.0 [R2; 0.4]] C1s
= 0.2, C2s = 0.4
T3
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
4 3 2 1 4 3 2 1

t(R1)

t(R2)
4 3 2 1

ˆ
(t)
Example Task фi p i ei πi Critical Sections
T1 0.5 2 0.2 - [R1;0.2] C1s = 0
T1 T2 0 3 1.5 1 [R2;0.7] C1s = 0.3
T2 T3 0 5 1.2 2 [R1; 1.0 [R2; 0.4]] C1s
= 0.2, C2s = 0.4
T3
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
4 3 2 1 4 3 2 1

t(R1)

t(R2)
4 3 2 1

ˆ
(t)
Example Task фi p i ei πi Critical Sections
T1 0.5 2 0.2 - [R1;0.2] C1s = 0
T1 T2 0 3 1.5 1 [R2;0.7] C1s = 0.3
T2 T3 0 5 1.2 2 [R1; 1.0 [R2; 0.4]] C1s
= 0.2, C2s = 0.4
T3
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
4 3 2 1 4 3 2 1

t(R1)

t(R2)
4 3 2 1

ˆ
(t)
Example Task фi p i ei πi Critical Sections
T1 0.5 2 0.2 1 [R1;0.2] C1s = 0
T1 T2 0 3 1.5 2 [R2;0.7] C1s = 0.3
T2 T3 0 5 1.2 3 [R1; 1.0 [R2; 0.4]] C1s
= 0.2, C2s = 0.4
T3
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
4 3 2 1 4 3 2 1

t(R1)

t(R2)
4 3 2 1

ˆ
(t)
1.2
1.7 Example Task фi p i ei πi Critical Sections
T1 0.5 2 0.2 - [R1;0.2] C1s = 0
T1 T2 0 3 1.5 1 [R2;0.7] C1s = 0.3
T2 T3 0 5 1.2 2 [R1; 1.0 [R2; 0.4]] C1s
= 0.2, C2s = 0.4
T3
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
4 3 2 1 4 3 2 1

t(R1)

t(R2)
4 3 2 1

ˆ
(t)
1.2
1.7 Example Task фi p i ei πi Critical Sections
T1 0.5 2 0.2 - [R1;0.2] C1s = 0
T1 T2 0 3 1.5 - [R2;0.7] C1s = 0.3
T2 T3 0 5 1.2 1 [R1; 1.0 [R2; 0.4]] C1s
= 0.2, C2s = 0.4
T3
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
4 3 2 1 4 3 2 1

t(R1)

t(R2)
4 3 2 1

ˆ
(t)
1.2
1.7
2.1
Example Task фi p i ei πi Critical Sections
T1 0.5 2 0.2 1 [R1;0.2] C1s = 0
T1 T2 0 3 1.5 - [R2;0.7] C1s = 0.3
T2 T3 0 5 1.2 2 [R1; 1.0 [R2; 0.4]] C1s
= 0.2, C2s = 0.4
T3
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
4 3 2 1 4 3 2 1

J1,2 is released but immediately blocked since it


t(R1) requests for R1 which is held by J3,1.

t(R2)
4 3 2 1

ˆ
(t)
1.2
1.7
2.1
Example Task фi p i ei πi Critical Sections
T1 0.5 2 0.2 1 [R1;0.2] C1s = 0
T1 T2 0 3 1.5 - [R2;0.7] C1s = 0.3
T2 T3 0 5 1.2 - [R1; 1.0 [R2; 0.4]] C1s
= 0.2, C2s = 0.5
T3
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
4 3 2 1 4 3 2 1

J3,1 completes .
t(R1)

t(R2)
4 3 2 1

ˆ
(t)
1.2
1.7
3.1
Example Task фi p i ei πi Critical Sections
T1 0.5 2 0.2 1 [R1;0.2] C1s = 0
T1 T2 0 3 1.5 2 [R2;0.7] C1s = 0.3
T2 T3 0 5 1.2 - [R1; 1.0 [R2; 0.4]] C1s
= 0.2, C2s = 0.5
T3
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
4 3 2 1 4 3 2 1

J2,2 released .
t(R1)

t(R2)
4 3 2 1

ˆ
(t)
1.2
1.7
3.1 4.1
Example Task фi p i ei πi Critical Sections
T1 0.5 2 0.2 - [R1;0.2] C1s = 0
J1,3 released .
T1 T2 0 3 1.5 1 [R2;0.7] C1s = 0.3
T2 T3 0 5 1.2 - [R1; 1.0 [R2; 0.4]] C1s
= 0.2, C2s = 0.5
T3
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
4 3 2 1 4 3 2 1

t(R1)

t(R2)
4 3 2 1

ˆ
(t)
1.2
1.7
3.1 4.1 4.6
Example Task фi p i ei πi Critical Sections
T1 0.5 2 0.2 2 [R1;0.2] C1s = 0
J1,3 released .
T1 T2 0 3 1.5 1 [R2;0.7] C1s = 0.3
T2 T3 0 5 1.2 - [R1; 1.0 [R2; 0.4]] C1s
= 0.2, C2s = 0.5
T3
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
4 3 2 1 4 3 2 1

t(R1)

t(R2)
4 3 2 1

ˆ
(t)
1.2
1.7
3.1 4.1 4.6
Example Task фi p i ei πi Critical Sections
T1 0.5 2 0.2 1 [R1;0.2] C1s = 0
T1 T2 0 3 1.5 - [R2;0.7] C1s = 0.3
T2 T3 0 5 1.2 - [R1; 1.0 [R2; 0.4]] C1s
= 0.2, C2s = 0.5
T3
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
4 3 2 1 4 3 2 1

t(R1)

t(R2)
4 3 2 1

ˆ
(t)
Priority Inheritance Protocol
Here there can be more than 1 unit of each resource

When a job J requests for ki units (ki ≤ vi) of resource Ri and there are no free ki
units, the job is blocked

If requested number of resources are available, the job is scheduled

We need to modify the inheritance rule since the resources might be held by
multiple low priority jobs

Inheritance rule: When the requesting job J becomes blocked at t, the job with the
highest priority among all the jobs holding the resource Ri inherits J’s priority until
it releases its unit of Ri
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1,2;1] C1s = 1
J2 5 3 2 [R2;2] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2,2;1.5] ] C1s
= 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1
R1 number of units 2
J2 R2 number of units 2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1,2;1] C1s = 1
J2 5 3 2 [R2;2] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2,2;1.5] ] C1s
= 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1
R1 number of units 2
J2 R2 number of units 2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1,2;1] C1s = 1
J2 5 3 2 [R2;2] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2,2;1.5] ] C1s
= 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1
R1 number of units 2
J2 R2 number of units 2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1,2;1] C1s = 1
J2 5 3 2 [R2;2] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2,2;1.5] ] C1s
= 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1
R1 number of units 2
J2 R2 number of units 2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1,2;1] C1s = 1
J2 5 3 2 [R2;2] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2,2;1.5] ] C1s
= 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1
R1 number of units 2
J2 R2 number of units 2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1,2;1] C1s = 1
J2 5 3 2 [R2;2] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2,2;1.5] ] C1s
= 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1
R1 number of units 2
J2 R2 number of units 2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1,2;1] C1s = 1
J2 5 3 2 [R2;2] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2,2;1.5] ] C1s
= 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1
R1 number of units 2
J2 R2 number of units 2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1,2;1] C1s = 1
J2 5 3 2 [R2;2] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2,2;1.5] ] C1s
= 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1
R1 number of units 2
J2 R2 number of units 2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1,2;1] C1s = 1
J2 5 3 2 [R2;2] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2,2;1.5] ] C1s
= 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1
R1 number of units 2
J2 R2 number of units 2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1,2;1] C1s = 1
J2 5 3 2 [R2;2] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2,2;1.5] ] C1s
= 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1
R1 number of units 2
J2 R2 number of units 2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Example Jo ri ei πi Critical Sections
b
J1 7 3 1 [R1,2;1] C1s = 1
J2 5 3 2 [R2;2] C1s = 1
J3 4 2 3
J4 2 6 4 [R1;4[R2,2;1.5] ] C1s
= 1, C2s = 3
J5 0 6 5 [R2;4] C1s = 1

J1
R1 number of units 2
J2 R2 number of units 2

J3

J4

J5
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Priority Ceiling Protocol
(Ri,k), for k ≤ vi , denote the priority ceiling of a resource Ri when k out of the νi
units of Ri are free

Priority Ceiling of Resource: If one or more jobs in the system require more than k
units of Ri, (Ri , k) is the highest priority among all these jobs

If no job requires more than k units of Ri , (Ri,k) is equal to 

(Ri,0) denotes the priority ceiling when Ri has a single unit

The (current) priority ceiling of the system at time t ((t)) is equalˆ to the highest
priority ceiling of all the resources at that time
Priority Ceiling Protocol
Allocation Rule: Whenever a job J requests k units of resource R at time t

(a)Less than k units of R are free, J becomes is blocked

(i) If J’s priority π(t) is higher than the current priority ceiling of the system at the
time, k units of R are allocated to J until it releases them

(ii) If J’s priority π(t) is not higher than the system ceiling, k units of R are allocated
to J only if J holds the resource(s) whose priority ceiling is system priority ceiling
otherwise, J ’s request is denied, and J becomes blocked
Priority Ceiling Protocol
Priority-Inheritance Rule: When the requesting job J becomes blocked at t, the job
with the highest priority among all the jobs holding the resource R that has the
highest priority ceiling among all the resources inherits J’s priority until it releases
its unit of R
Example Jo ri ei πi Critical Sections
b
J1 3.5 2.5 1 [R1,2;1.75[R2;1]]
C1s = 0.5 C2s = 1
J1 J2 2.5 2.5 2 [R2;1.75[R1,4;1]]
C1s = 0.5 C2s = 1
J2
J3 2 1 3
J3 J4 1 2.25 4 [R1;1.5] C1s = 0.5
J5 0 1.75 5 [R1;0.75] C1s = 0.5
J4

J5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5
#of R1 = 5
#of R2 = 1
2 1

(Ri,k) k
0 1 2 3 4
 5 4 3

(R1,k) 1 1 2 2 
(R2,k) 1    
Example Jo ri ei πi Critical Sections
b
J1 3.5 2.5 1 [R1,2;1.75[R2;1]]
C1s = 0.5 C2s = 1
J1 J2 2.5 2.5 2 [R2;1.75[R1,4;1]]
C1s = 0.5 C2s = 1
J2
J3 2 1 3
J3 J4 1 2.25 4 [R1;1.5] C1s = 0.5
J5 0 1.75 5 [R1;0.75] C1s = 0.5
J4

J5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5
#of R1 = 5
#of R2 = 1
2 1

(Ri,k) k
0 1 2 3 4
 5 4 3

(R1,k) 1 1 2 2 
(R2,k) 1    
Example Jo ri ei πi Critical Sections
b
J1 3.5 2.5 1 [R1,2;1.75[R2;1]]
C1s = 0.5 C2s = 1
J1 J2 2.5 2.5 2 [R2;1.75[R1,4;1]]
C1s = 0.5 C2s = 1
J2
J3 2 1 3
J3 J4 1 2.25 4 [R1;1.5] C1s = 0.5
J5 0 1.75 5 [R1;0.75] C1s = 0.5
J4

J5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5
#of R1 = 5
#of R2 = 1
2 1

(Ri,k) k
0 1 2 3 4
 5 4 3

(R1,k) 1 1 2 2 
(R2,k) 1    
Example Jo ri ei πi Critical Sections
b
J1 3.5 2.5 1 [R1,2;1.75[R2;1]]
C1s = 0.5 C2s = 1
J1 J2 2.5 2.5 2 [R2;1.75[R1,4;1]]
C1s = 0.5 C2s = 1
J2
J3 2 1 3
J3 J4 1 2.25 4 [R1;1.5] C1s = 0.5
J5 0 1.75 5 [R1;0.75] C1s = 0.5
J4

J5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5
#of R1 = 5
#of R2 = 1
2 1

(Ri,k) k
0 1 2 3 4
 5 4 3

(R1,k) 1 1 2 2 
(R2,k) 1    
Example Jo ri ei πi Critical Sections
b
J1 3.5 2.5 1 [R1,2;1.75[R2;1]]
C1s = 0.5 C2s = 1
J1 J2 2.5 2.5 2 [R2;1.75[R1,4;1]]
C1s = 0.5 C2s = 1
J2
J3 2 1 3
J3 J4 1 2.25 4 [R1;1.5] C1s = 0.5
J5 0 1.75 5 [R1;0.75] C1s = 0.5
J4

J5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5
#of R1 = 5
#of R2 = 1
2 1

(Ri,k) k
0 1 2 3 4
 5 4 3

(R1,k) 1 1 2 2 
(R2,k) 1    
Example Jo ri ei πi Critical Sections
b
J2 is blocked since current priority J1 3.5 2.5 1 [R1,2;1.75[R2;1]]
less than system priority ceiling C1s = 0.5 C2s = 1
J1 J2 2.5 2.5 2 [R2;1.75[R1,4;1]]
C1s = 0.5 C2s = 1
J2
J3 2 1 3
J3 J4 1 2.25 4 [R1;1.5] C1s = 0.5
J5 0 1.75 5 [R1;0.75] C1s = 0.5
J4

J5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5
#of R1 = 5
#of R2 = 1
2 1

(Ri,k) k
0 1 2 3 4
 5 4 3

(R1,k) 1 1 2 2 
(R2,k) 1    
Example Jo ri ei πi Critical Sections
b
J4 inherits the priority J1 3.5 2.5 1 [R1,2;1.75[R2;1]]
C1s = 0.5 C2s = 1
J1 J2 2.5 2.5 2 [R2;1.75[R1,4;1]]
C1s = 0.5 C2s = 1
J2
J3 2 1 3
J3 J4 1 2.25 4 [R1;1.5] C1s = 0.5
J5 0 1.75 5 [R1;0.75] C1s = 0.5
J4

J5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5
#of R1 = 5
#of R2 = 1
2 1

(Ri,k) k
0 1 2 3 4
 5 4 3

(R1,k) 1 1 2 2 
(R2,k) 1    
Example Jo ri ei πi Critical Sections
b
J1 3.5 2.5 1 [R1,2;1.75[R2;1]]
C1s = 0.5 C2s = 1
J1 J2 2.5 2.5 2 [R2;1.75[R1,4;1]]
C1s = 0.5 C2s = 1
J2
J3 2 1 3
J3 J4 1 2.25 4 [R1;1.5] C1s = 0.5
J5 0 1.75 5 [R1;0.75] C1s = 0.5
J4

J5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5
#of R1 = 5
#of R2 = 1
2 1

(Ri,k) k
0 1 2 3 4
 5 4 3

(R1,k) 1 1 2 2 
(R2,k) 1    
Example Jo ri ei πi Critical Sections
b
J1 3.5 2.5 1 [R1,2;1.75[R2;1]]
C1s = 0.5 C2s = 1
J1 J2 2.5 2.5 2 [R2;1.75[R1,4;1]]
C1s = 0.5 C2s = 1
J2
J3 2 1 3
J3 J4 1 2.25 4 [R1;1.5] C1s = 0.5
J5 0 1.75 5 [R1;0.75] C1s = 0.5
J4

J5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5
#of R1 = 5
#of R2 = 1
2 1

(Ri,k) k
0 1 2 3 4
 5 4 3

(R1,k) 1 1 2 2 
(R2,k) 1    
Example Jo ri ei πi Critical Sections
b
J1 3.5 2.5 1 [R1,2;1.75[R2;1]]
C1s = 0.5 C2s = 1
J1 J2 2.5 2.5 2 [R2;1.75[R1,4;1]]
C1s = 0.5 C2s = 1
J2
J3 2 1 3
J3 J4 1 2.25 4 [R1;1.5] C1s = 0.5
J5 0 1.75 5 [R1;0.75] C1s = 0.5
J4

J5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5
#of R1 = 5
#of R2 = 1
2 1

(Ri,k) k
0 1 2 3 4
 5 4 3

(R1,k) 1 1 2 2 
(R2,k) 1    
Example Jo ri ei πi Critical Sections
b
J1 3.5 2.5 1 [R1,2;1.75[R2;1]]
C1s = 0.5 C2s = 1
J1 J2 2.5 2.5 2 [R2;1.75[R1,4;1]]
C1s = 0.5 C2s = 1
J2
J3 2 1 3
J3 J4 1 2.25 4 [R1;1.5] C1s = 0.5
J5 0 1.75 5 [R1;0.75] C1s = 0.5
J4

J5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5
#of R1 = 5
#of R2 = 1
2 1

(Ri,k) k
0 1 2 3 4
 5 4 3

(R1,k) 1 1 2 2 
(R2,k) 1    
Example Jo ri ei πi Critical Sections
b
J1 3.5 2.5 1 [R1,2;1.75[R2;1]]
C1s = 0.5 C2s = 1
J1 J2 2.5 2.5 2 [R2;1.75[R1,4;1]]
C1s = 0.5 C2s = 1
J2
J3 2 1 3
J3 J4 1 2.25 4 [R1;1.5] C1s = 0.5
J5 0 1.75 5 [R1;0.75] C1s = 0.5
J4

J5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5
#of R1 = 5
#of R2 = 1
2 1

(Ri,k) k
0 1 2 3 4
 5 4 3

(R1,k) 1 1 2 2 
(R2,k) 1    
Example Jo ri ei πi Critical Sections
b
J1 3.5 2.5 1 [R1,2;1.75[R2;1]]
C1s = 0.5 C2s = 1
J1 J2 2.5 2.5 2 [R2;1.75[R1,4;1]]
C1s = 0.5 C2s = 1
J2
J3 2 1 3
J3 J4 1 2.25 4 [R1;1.5] C1s = 0.5
J5 0 1.75 5 [R1;0.75] C1s = 0.5
J4

J5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5
#of R1 = 5
#of R2 = 1
2 1

(Ri,k) k
0 1 2 3 4
 5 4 3

(R1,k) 1 1 2 2 
(R2,k) 1    

You might also like