1 / 14

Resource and Resource Access Control

Resource and Resource Access Control. Fred Kuhns Applied Research Laboratory Computer Science and Engineering Washington University in St. Louis. Blocking Time. Higher priority job is blocked by a lower priority job during a nonpreemptive interval: priority inversion . Nonpreemptivity:

mirit
Download Presentation

Resource and Resource Access Control

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. Resource and Resource Access Control Fred Kuhns Applied Research Laboratory Computer Science and Engineering Washington University in St. Louis

  2. Blocking Time • Higher priority job is blocked by a lower priority job during a nonpreemptive interval: priority inversion. • Nonpreemptivity: • bi(nb) = max(qk), i+1  k  n, qk ei • Self-Suspension • bi(ss) = max SS of Ti + sum[min(ek, max SS of Tk),k=1 to k=(i-1)] • Context Switch • bi(cs) = 2CS CS523 – Operating Systems

  3. i - 1 t ek k = 1 pk wi(t) = ei + bi(ss) + (Ki + 1)bi(np) + 2(Ki + 1)CS + Time Demand Analysis • Updated TDA equation to include blocking time. • But what about resource contention? CS523 – Operating Systems

  4. Effects of Resource Contention • Add new term for blocking • bi(rb) • Priority Inversion • Uncontrolled priority inversion • Timing Anomalies • Resulting from priority inversion • Deadlock • Circular wait CS523 – Operating Systems

  5. Resource Access Protocols • Resource Access protocol • Granting resource access requests • Scheduling of jobs which request resources • Goals: • Bound delay due to Priority Inversion and Timing Anomalies • Prevent Deadlock • Three Examples: • Nonpreemptive Critical Sections • No deadlock, No uncontrolled Priority Inversion • Priority Inheritance Protocol • Deadlock, No uncontrolled Priority Inversion • Priority Ceiling Protocol • No deadlock, No uncontrolled Priority Inversion CS523 – Operating Systems

  6. Some Notation • Ji is the ith job in Task T. Shorthand for Jji • i = Assigned priority of Job Ji; i(t) = current priority of Ji • If the decision to change the priority of Job Ji is made at t = t1 then • t- = t -  and t+ = t + ; • i(t1-) = priority at and immediately before t1, • i(t1+) = priority immediately after the priority change •  = nonexistent priority, lower than the lowest priority • At time t1 Job Ji requests resource Rk. • Rk Jl: Resource Rk is held by Job Jl • Ji  Rk: Ji blocked onRk (Ji  Rk  Jl) • General scheduling and allocation assumptions: • Scheduling Rules: • Ready Jobs scheduled on processors preemptively in a priority driven manner according to their current priorities, i(t). • At Job release time the priority is equal to its assigned priority: if Ji released at t’, then i(t’) = i • Resource allocation: • If a resource is free then it is allocated when requested • if not free then the request is denied and the requesting job is blocked CS523 – Operating Systems

  7. Nonpreemptive Critical Sections Protocol • Blocking time is bounded:bi(rc)=max(ck) for k = i+1,...,n andck is the max critical section time of any job in task Tk. • NCSP Rule: • If Ji holds a resource it effectively has the highest priority in the system: i.e. it will not be preempted while holding a resource. So no deadlock. • Assessment: • Advantage: simple and does not require prior knowledge of resource usage. Bounds delays and prevents deadlock. • Disadvantage, every job can be blocked by a lower priority job regardless of whether it contends for the same resources. CS523 – Operating Systems

  8. Priority Inheritance Rules (PI) • Scheduling Rule: consistent with assumptions • Allocation Rule: consistent with assumptions • Priority-Inheritance Rule: if Ji  Rk Jl and l(t1-) < i(t1) then l(t1+) = i(t1) until Jlreleases Rkwhen l(t2+) = l(t1-) • Assessment: • simple and works with any priority driven scheduler. Does not require foreknowledge. When no deadlock, no unbounded delay. • Two types of blocking: Direct and Priority Inheritance blocking • PI has the transitive property. • Does not result in minimal blocking time • Does not prevent deadlock CS523 – Operating Systems

  9. Basic Priority Ceiling Rules • Extends PI to prevent deadlock and reduce blocking time • Assumptions: • general scheduling rule; fixed assigned priorities; resource requirements of tasks known • (Rk)=priority ceiling for Rk=max(i) for all Ji requiring Rk • System priority ceiling = (t)=max[(Rk)] for all Rk in use at time t. If no resource in use then (Rk) =  • Allocation Rule (Ji requests Rk at time t=t1): • if Ji  Rk Jl at t = t1 then block Ji (no change) • else (Rk free at t1) if i(t1) > (t), then Rk Ji else if for some Rx Jiand (Rx) = (t1), then Rk Ji else deny and block (Ji  Rk) • Priority-Inheritance Rule: • if Ji blocks on resource Rk held by Jl (Ji  Rk)(note: RkJl and l(t1-)=priority of Jl at t = t1-)then l(t1+) = i(t1) (inherited priority) until Jlreleases all Rxwith (Rx)  (t1) at t = t2 , l(t2+) = l(t1-) CS523 – Operating Systems

  10. Ji R Jk Jh R Jl Comparisons • Priority Ceiling • No deadlocks: Priority ceilings impose order on resources • bounded blocking time by at most the duration of one critical section. • Priority inheritance is greedy while priority ceiling is not • If π (t) of a Job J is > (t) then neither J nor any other job with priorities ≥ π (t) need any resource currently in use. Jk Directly Blocked Priority Inheritance blocking high priority job block by lower priority job that inherited a higher priority. πh>πl, πk>πl and πh>πk. But the current priority of Jl, πh(t)=πh so Jk is blocked from running. Ji R X Jk Avoidance Blocking (Priority Ceiling Blocking) (X) ≥ πi(t) CS523 – Operating Systems

  11. Stack-Based Priority Ceiling Protocol • Update Current Ceiling in the usual manner • When no resources are held the (t) =  • otherwise, (t) = max[(Rk)] for all Rk in use at time t. • Scheduling Rule: • when Ji released it is blocked until its assigned priority = i(t) > (t) • When not blocked jobs are scheduled in a priority-driven, preemptive manner according to their assigned priorities. • Allocation Rule: • Allocate when requested CS523 – Operating Systems

  12. Stack-based Priority Ceiling • Assume jobs never self suspend • After a job is released, when it begins to execute all the resources it needs are free • no job is ever blocked once its execution begins • when a job is preempted, all the resources needed by the preempting job are available • deadlock will not occur • Has the same worst-case performance as the basic priority ceiling protocol CS523 – Operating Systems

  13. Ceiling-Priority Protocol • Update Current Ceiling in the usual manner • If jobs never self suspend then the stack-based priority-ceiling and ceiling-priority protocols produce the same schedules. • maximum blocking time is same as stack-based and basic priority ceiling protocols. • Scheduling Rule: • No resources held then schedule according to assigned priorities (Ji has priority i(t) = i). Jobs with same priority are scheduled in FIFO order. • When a job, Ji, holds one or more resources then its priority i(t) = max((Rx)) for all resource Rx held by Ji • Allocation Rule: • Allocate when requested CS523 – Operating Systems

  14. Comparison • worst case performance of stack-based and basic ceiling protocols are the same • stack-based version • supported by the Real-Time systems Annex of Ada95 • Jobs must not self-suspend • when jobs do not self-suspend, stack-based and ceiling-priority protocols yield the same schedules. • stack-based and ceiling-priority have the same worst-case blocking time. CS523 – Operating Systems

More Related