Clock Driven Scheduling

Slides:



Advertisements
Similar presentations
REAL TIME SYSTEM Scheduling.
Advertisements

Clock-driven Static scheduling 5/24/2013Amrita-UB-MSES
ECE 493T9 Real Time Embedded System Tutorial Set 5 July 14, Spring 2008.
Real Time Scheduling Terminologies define Fixed Priority Scheduler
CSE 522 Real-Time Scheduling (4)
Module 2 Priority Driven Scheduling of Periodic Task
By Group: Ghassan Abdo Rayyashi Anas to’meh Supervised by Dr. Lo’ai Tawalbeh.
Module 2 Clock-Driven Scheduling
Memory Management Chapter 7.
Task Scheduling By Dr. Amin Danial Asham.
Scheduling policies for real- time embedded systems.
Subject: Operating System.
Clock Driven Scheduling By Dr. Amin Danial Asham.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
Chapter 5: Process Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Basic Concepts Maximum CPU utilization can be obtained.
Undergraduate course on Real-time Systems Linköping 1 of 45 Autumn 2009 TDDC47: Real-time and Concurrent Programming Lecture 5: Real-time Scheduling (I)
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems RMS and EDF Schedulers.
Real-Time systems By Dr. Amin Danial Asham.
CSCI1600: Embedded and Real Time Software Lecture 24: Real Time Scheduling II Steven Reiss, Fall 2015.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
CS6502 Operating Systems - Dr. J. Garrido Memory Management – Part 1 Class Will Start Momentarily… Lecture 8b CS6502 Operating Systems Dr. Jose M. Garrido.
Dynamic Priority Driven Scheduling of Periodic Task
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
Clock Driven Scheduling
Clock Driven Schedulers
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
1 Lecture 5: CPU Scheduling Operating System Fall 2006.
Clock-Driven Scheduling (in-depth) Task Scheduler: i := 0; k := 0; BEGIN LOOP i := i+1; k:= i mod N; IF J(t k-1 )is empty THEN wakeup(aperiodic) ELSE wakeup(J(t.
Embedded System Scheduling
Memory Management Chapter 7.
Chapter 7 Memory Management
Memory Management Chapter 7.
Memory Management.
CPU SCHEDULING.
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
Structured Cyclic Schedule
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
CPU Scheduling G.Anuradha
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 5: CPU Scheduling
Operating System Concepts
Clock-driven Static scheduling
Software life cycle models
Clock-driven Static scheduling
Processor Fundamentals
Clock-driven Static scheduling
3: CPU Scheduling Basic Concepts Scheduling Criteria
Chapter5: CPU Scheduling
CSCI1600: Embedded and Real Time Software
Chapter 6: CPU Scheduling
Outline Scheduling algorithms Multi-processor scheduling
Limited-Preemption Scheduling of Sporadic Tasks Systems
Clock-driven Static scheduling
Chapter 5: CPU Scheduling
Scheduling Basic Concepts Ref: Hard Real-Time Computing Systems Giorgio Buttazzo Ref: Real-Time Systems & Software Alan Shaw Processes - Tasks.
CSCI1600: Embedded and Real Time Software
Processes and operating systems
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Shortest-Job-First (SJR) Scheduling
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Real-Time Process Scheduling Concepts, Design and Implementations
Chapter 6: CPU Scheduling
Operating Systems: Internals and Design Principles, 6/E
Real-Time Process Scheduling Concepts, Design and Implementations
Chapter 7 Memory Management
CPU Scheduling: Basic Concepts
Module 5: CPU Scheduling
Presentation transcript:

Clock Driven Scheduling By Dr. Amin Danial Asham

Real-time Systems Theory and Practice. By Rajib mall References Real-time Systems Theory and Practice. By Rajib mall

Example1: A cyclic scheduler is to be used to run the following set of periodic tasks on a uniprocessor: T1 = (e1=1,P1=4), T2 = (e2=1,P2=5), T3 = (e3=1,P3=20), T4 = (e4=2,P4=20). Select an appropriate frame size. Solution: For the given task set, an appropriate frame size is the one that satisfies all the three required constraints. The Major Cyle M = LCM(4,5,20) =20. Constraint 1. Frames must be sufficiently long so that every job can start and complete within a single frame:, then maxi {ei} ≤ F. Therefore, we get F ≥ 2   Constraint 2. The major cycle must have an integer number of frames. Therefore, the possible values of F are 2, 4, 5, 10, 20.  

Table of GCD of all possible frame sizes and task periods Constraint 3. To satisfy this constraint, we need to check whether a selected frame size F satisfies the inequality: 2F - GCD(F,Pi) ≤ di for each Pi. 2 4 5 10 20 1 F Pi Table of GCD of all possible frame sizes and task periods Suitable Frame Size 2 4 5 10 20 True False F di Table of the 3rd constraint 2F - GCD(F,Pi) ≤ di

Example1 (cont.): T1 T2 T3 T4 T1 T2 T3 T4 T1 T2 T1 T2 T1 T2 T1 T1 T2 T4 T1 T2 T1 T2 T1 T3 T1 T2 2 4 6 8 10 12 14 16 18 20 T1 T2 T3 T4 T1 T2 T3 T4 T1 T2 T1 T2 T1 T2 T1 T1 T2 T4 T3 T1 T2 T1 T2 T1 T4 T3 T1 T2 2 4 6 8 10 12 14 16 18 20

Example 2 Consider the following set of periodic real-Time tasks to be scheduled by a cyclic scheduler: T1 (e1=1, P1=4), T2 = (e2=2,P2=5), T3 = (e3=5,P3=20). Determine a suitable frame size for the task set.  Solution: Major cycle M = LCM (4, 5, 20) = 20 Constraint 1: F ≥ 5. Constraint 2: the possible values of F are 5, 10 and 20. Constraint 3: 5 10 20 4 1 2 F Pi Table of GCD of all possible frame sizes and task periods 5 10 20 4 False True F di Table of the 3rd constraint 2F - GCD(F,Pi) ≤ di No Suitable Frame size

Example 2 (cont.) It is easy to observe that the task T3 has the largest execution Time and consequently due to the constraint 1 makes the feasible frame sizes quite large. We try splitting T3 into two or three tasks. After splitting T3 into three tasks, we have: T3.1 = (20, 1, 20), T3.2 = (20, 2, 20), T3.3 = (20, 2, 20). Constraint 1: F ≥ 2. Constraint 2: the possible values of F are 2,4,5, 10 and 20. Constraint 3: F 2 4 5 10 20 1 Pi Table of GCD of all possible frame sizes and task periods F Suitable Frame size 2 4 5 10 20 True False di Table of the 3rd constraint 2F - GCD(F,Pi) ≤ di

Note It is very difficult to come up with a clear set of guidelines to identify the exact task that is to be split, and the parts into which it needs to be split. This therefore needs to be done by trial and error. Further, as the number of tasks to be scheduled increases, this method of trial and error becomes impractical since each task needs to be checked separately. However, when the task set consists of only a few tasks we can easily apply this technique to find a feasible frame size for a set of tasks otherwise un-schedulable by a cyclic scheduler.

Example 3: T1 = (e1=1,p1=4); T2 = (e2=1 Example 3: T1 = (e1=1,p1=4); T2 = (e2=1.8,p2=5); T3 = (e3=1,p3=20); T4 = (e4=2,p4=20). Solution: M=LCM(4,5,20,20)=20 U=1/4+1.8/5+1/20+2/20= 0.76 F≥2 Possible frame sizes 2,4,5,10,20 2f – GCD(pi,f) ≤ di 1 ≤ i ≤ 4 F=2 T1 : 4 – 2 ≤ 4 (OK) T2 : 4 – 1 ≤ 5 (OK) T3 and T4: 4 – 2 ≤ 20 (OK) F=4 T1 : 8 – 4 ≤ 4 (OK) T2 : 8 – 1 ≤ 5 (NO) Suitable size F=5 : T1 : 10 – 1 ≤ 4 (NO) F=10: T1 : 20 – 2 ≤ 4 (NO) F=20: T1 : 40 – 4 ≤ 4 (NO)

Example 3 (cont.) T1 T2 T3 T4 T1 T2 T3 T4 T1 T2 T1 T2 T1 T2 T1 T1 T3 T2 T1 T4 T2 T1 T2 T1 T1 T2 2 4 6 8 10 12 14 16 18 20 T1 T2 T3 T4 T1 T2 T3 T4 T1 T2 T1 T2 T1 T2 T1 T1 T3 T2 T1 T2 T1 T2 T1 T4 T1 T2 2 4 6 8 10 12 14 16 18 20

Example 4: T1 = (p1=15,e1=1,d1=14); T2 = (p2=20,e2=2,d2=26); T3 = (e3=3, p3=22). Solution: M=LCM(15,20,22)=660 U=1/15+2/20+3/22= 0.303 F≥3 Possible frame sizes 3,4,5,10,11,15,20,22 (Note: f divides the Major Cycle M; this is true if f divides at least one pi) 2f – GCD(Pi,f) ≤ di 1 ≤ i ≤ 3 F=3 T1 : 6 – 3 ≤ 14 (OK) T2 : 6 – 1 ≤ 26 (OK) T3 : 6 – 1 ≤ 22 (OK) F=4 T1 : 8 – 1 ≤ 14 (OK) T2 : 8 – 4 ≤ 26 (OK) T3 : 8 – 2 ≤ 22 (OK) F=5 T1: 10 – 5 ≤ 14 (OK) T2: 10 – 5 ≤ 26 (OK) T3: 10 – 1 ≤ 22 (OK) Suitable sizes 3,4,and 5 F = 10: T1: 20 – 5 ≤ 14 (NO) F= 11: T1: 22 – 1 ≤ 14 (NO) F= 15: T1: 30 –15 ≤ 14 (NO) F= 20: T1: 40 – 5 ≤ 14 (NO) F= 22: T1: 44 – 1 ≤ 14 (NO)

constructing a cyclic schedule Design steps and decisions to consider in the process of constructing a cyclic schedule Determine the Major Cycle M Determine the total utilization U (if >1 schedule is unfeasible) Choose a frame size that meets the constraints Partition jobs into slices, if necessary Place slices in the frames.

A Generalized Task Scheduler Many practical applications typically consist of a mixture of several periodic, aperiodic, and sporadic tasks. Aperiodic and sporadic tasks can be accommodated by cyclic schedulers. In generalized scheduler: In a generalized scheduler, initially a schedule (assignment of tasks to frames) for only periodic tasks is prepared. The sporadic and aperiodic tasks are scheduled in the slack times that may be available in the frames. Slack time in a frame is the time left in the frame after a periodic task allocated to the frame completes its execution. Non-zero slack time in a frame can exist only when the execution time of the task allocated to it is smaller than the frame size.

Notes: A sporadic task is taken up for scheduling only if enough slack time is available for the arriving sporadic task to complete before its deadline. Therefore, a sporadic task on its arrival is subjected to an acceptance test. The acceptance test checks whether the task is likely to be completed within its deadline when executed in the available slack times. If it is not possible to meet the task’s deadline, then the scheduler rejects it and the corresponding recovery routines for the task are run. For aperiodic tasks no acceptance test is done, but no guarantee is given for a task’s completion time and best effort is made to complete the task as early as possible. An efficient implementation of this scheme is that the slack times are stored in a table and during acceptance test this table is used to check the schedulability of the arriving tasks. Another popular alternative is that the aperiodic and sporadic tasks are accepted without any acceptance test, and best effort is made to meet their respective deadlines.

Comparison of Cyclic with Table-Driven Scheduling Both table-driven and cyclic schedulers are important clock-driven schedulers. Cyclic scheduling: needs to set a periodic timer only once at the application initialization time. This timer continues to give an interrupt exactly at every frame boundary. No overhead of setting the timer each time a task starts.

Comparison of Cyclic with Table-Driven Scheduling (cont.) Table-driven scheduling: a timer has to be set every time a task starts to run. The execution time of a typical real-time task is usually of the order of a few milliseconds. Therefore, a call to a timer is made every few mill Seconds. This represents a significant overhead and results in degraded system performance . However, if the overhead of setting a timer can be ignored, a table-driven scheduler is more proficient than a cyclic scheduler because the size of the frame that needs to be chosen should be at least as long as the size of the largest execution time of a task in the task set. This is a source of inefficiency, since this results in processor time being wasted in case of those tasks whose execution times are smaller than the chosen frame size.

Thanks