0% found this document useful (0 votes)
22 views

Resource and Resource Access Control: Prepared By-Gajendra Shrimal Mtech I Sem Computer Engineering

The document discusses resources and resource access control. It defines resources as either passive resources like memory or active resources like processors. It then discusses different resource access control protocols like non-blocking critical section, priority inheritance protocol, priority ceiling protocol, stack-based priority ceiling protocol, and ceiling priority protocol. These protocols establish rules for granting access to shared resources and scheduling jobs to avoid issues like priority inversion and deadlocks.

Uploaded by

Gajendra Shrimal
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Resource and Resource Access Control: Prepared By-Gajendra Shrimal Mtech I Sem Computer Engineering

The document discusses resources and resource access control. It defines resources as either passive resources like memory or active resources like processors. It then discusses different resource access control protocols like non-blocking critical section, priority inheritance protocol, priority ceiling protocol, stack-based priority ceiling protocol, and ceiling priority protocol. These protocols establish rules for granting access to shared resources and scheduling jobs to avoid issues like priority inversion and deadlocks.

Uploaded by

Gajendra Shrimal
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Resource and Resource

Access Control
Prepared By-
Gajendra Shrimal
MTech Ist Sem

ECA Computer Engineering


Govt. Engineering College, Ajmer
Contents :

 Introduction to Resources

 Resource Access Control

ECA Govt. Engineering College, Ajmer


Resources
What are the Resources ?
A system can be divided in two major types
- Processors
- Resources
A job may need some entities to perform its
execution in addition to processors, called
Resources.
By Resources,we specifically means Passive Resource.
Examples are – Memory, Sequence Numbers, Data
base locks
ECA Govt. Engineering College, Ajmer
Resources…
 Resources can be divided into passive and active :

Active resources == Processors (Pi): they execute jobs.


Every job must have one or more processors .
Same type if functionally identical and used interchangeably.

Passive resource == Resource (Ri):


job may require Resources in addition to processor.
reusable resources are not consumed

* A resource is said to be plentiful if no job is ever


prevented from execution by the lack of resource.
ECA Govt. Engineering College, Ajmer
Resource Access Control
 A resource access control protocol, or simply a access
control protocol is a set of rules that govern

- when and under what conditions each


request for resource is granted

- how jobs requiring resource are scheduled

ECA Govt. Engineering College, Ajmer


Resource Access Control
 These are the solutions to Priority Inversion
 Some of the well known resource access control
protocol are:
-Non Blocking Critical Section
-Basic Priority-Inheritance Protocol
-Basic Priority-Ceiling Protocol
-Stack Based, Priority-Ceiling(Ceiling-
Priority) Protocol
-Preemption-Ceiling Protocol

ECA Govt. Engineering College, Ajmer


No Blocking Critical Section
 When ever a job holds any resource, it executes at priority
higher then the priorities of all jobs.

 Because no job is ever preempted when it holds any


resource, Dead Lock can never occur.

 This is called Non Preemptive Critical Section Protocol.

 Simplest way to control access of resources.

ECA Govt. Engineering College, Ajmer


No Blocking Critical Section..

ECA Govt. Engineering College, Ajmer


Priority Inheritance Protocol
 Jobs that are not blocked are scheduled according ot a priority-driven
algorithm preemptively on a processor.
 Priorities of tasks are fixed, except for the conditions described below:
 A job J requests a resource R by executing lock(R)
 If R is available, it is allocated to J. J then continues to execute and releases R
by executing unlock(R)
 If R is allocated to J’, J’ directly blocks J. The request for R is denied.
 However: Let p = priority of J when executing lock(R)
p’ = priority of J’ at the same time
 For as long as J’ holds R, its priority is max(p, p’) and returns to p’ when it
releases R.
 That is: J’ inherits the priority of J when J’ directly blocks J and J has a higher
priority.
 Priority Inheritance is transitive.

ECA Govt. Engineering College, Ajmer


Properties
 It does not prevent deadlock.
 Task can be blocked directly by a task with a lower priority
at most once, for the duration of the (outmost) critical
section.
 Consider a task whose priority is higher than n other
tasks:
 Each of the lower-priority tasks can directly block the task
at most once
 A task outside the critical section cannot directly block a
higher-priority task.

ECA Govt. Engineering College, Ajmer


Priority Ceiling Protocol
Assumptions:
Priorities of tasks are fixed
Resources required by tasks are known

Definition (Priority Ceiling of R)


Priority Ceiling PR of R = highest priority of all tasks that will request R.
Any task holding R may have priority PR at some point; either its own priority is PR ,
or it inherits PR .

Motivation:
Suppose there are resource A and B.
Both A and B are available. T1 requests A.
T2 requests B after A is allocated.
If p2 > PA : T1 can never preempt T2  B should be allocated to T2.
If p2  PA : T1 can preempt T2 (and also request B) at some later time. B should not be allocated to
T2, to avoid deadlock.
ECA Govt. Engineering College, Ajmer
Priority Ceiling Protocol..
 Same as the basic Priority Inheritance Protocol, except for the following:

 When a task T requests for allocation of a resource R by executing lock


(R) :

 The request is denied if


 R is already allocated to T’. (T’ directly blocks T.)

 The priority of T is not higher than all priority ceilings fo resources allocated to
tasks other than T at the time. (These tasks block T.)
 Otherwise, R is allocated to T.

 When a task blocks other tasks, it inherits the highest of their priorities.

ECA Govt. Engineering College, Ajmer


Stack Sharing Priority Ceiling
 To avoid deadlocks: Once execution begins, make sure that job is not
blocked due to resource access.
 Otherwise: Low-priority, preempted, jobs may re-acquire access to CPU,
but can not continue due to unavailability of stack space.

 Define: (t) : highest priority ceiling of all resources currently


allocated.
If no resource allocated, (t) = .
 Protocol:
1. Update Priority Ceiling: Whenever all resources are free, (t) = .
The value of (t) is updated whenever resource is allocated or freed.
2. Scheduling Rule: After a job is released, it is blocked from starting
execution until its assigned priority is higher then (t). At all times,
jobs that are not blocked are scheduled on the processor in a priority-
driven, preemptive fashion according to their assigned priorities.
3. Allocation Rule: Whenever a job requests a resource, it is allocated
the resource.
ECA Govt. Engineering College, Ajmer
Stack Based Priority Ceiling Protocol
 The Stack-Based Priority-Ceiling Protocol is deadlock-free:
When a job begins to execute, all the resources it will ever need are free.
Otherwise, (t) would be higher or equal to the priority of the job.

Whenever a job is preempted, all the resources needed by the preempting job
are free.
The preempting job can complete, and the preempted job can resume.

 Worst-case blocking time of Stack-Based Protocol is the same as for Basic


Priority Ceiling Protocol.

 Stack-Based Protocol smaller context-switch overhead (2 CS) than Priority


Ceiling Protocol (4 CS)
Once execution starts, job cannot be blocked.

ECA Govt. Engineering College, Ajmer


Ceiling Priority Protocol
 Stack-Based Protocol does not allow for self-suspension
Stack is shared resource
 Re-formulation for multiple stacks (no stack-sharing)
straightforward:
 Ceiling-Priority Protocol
Scheduling Rules:
1. Every job executes at its assigned priority when it does not
hold resources.
2. Jobs of the same priority are scheduled on FIFO basis.

3. Priority of jobs holding resources is the highest of the priority


ceilings of all resources held by the job.
Allocation Rule:
Whenever a job requests a resource, it is allocated the resource.

ECA Govt. Engineering College, Ajmer


ECA Govt. Engineering College, Ajmer

You might also like