Structured Cyclic Schedule Example Structured Cyclic Schedule
Question: The following system of periodic tasks is to be scheduled and executed according to a structured cyclic schedule with fixed frame size. T1=(4, 1), T2=(5,1.8), T3=(20,1) and T4=(20,2). What is the appropriate frame size?( Show your work including LCM and GCD calculation ) What do the resulting cyclic scheduler tables look like (show the first 4 frame only)?
Jobs to start and complete execution within a single frame: What is the appropriate frame size? Eq.1: Jobs to start and complete execution within a single frame: f ≥ max(e1, e2, …, en) f ≥max(1,1.8,1,2) thus: f ≥ 2
Eq.2: The hyper-period should be an integer multiple of the frame size (f divides evenly into the period of at least one task): [pi/f]- pi/f =0
How to approach equation 2: Calculate the hyper-period = lcm (4,5,20,20) = 20 Pick the smallest period and largest period of your tasks. (in this case 2 and 20) Thus your possible value frame (f) values are 2, 20 and any number in between 2 and 20 which divides evenly with the hyper- period of the system. Dividing the hyper- period which is 20 with all the values in the range of 2 to 20, you shall found that 2,4,5,10 and 20 are the only number which divides evenly with 20 and the period of at least one task. Thus, your possible f value as per equation 2 is concern is: f {2, 4,5,10,20}
Eq.3: At least one frame boundary between release time of a job and its deadline: 2*f – gcd(pi, f ) ≤ Di for i = 1, 2, …, n
Let us try frame size 2 2 x 2 – gcd (4,2) ≤ 4 ≡ 4 – 2 ≤ 4 TRUE 2 x 2 – gcd (5,2) ≤ 5 ≡ 4 – 1 ≤ 5 TRUE 2 x 2 – gcd (20,2) ≤ 20 ≡ 4 – 2 ≤ 20 TRUE Let us try frame size 4 2 x 4 – gcd (4,4) ≤ 4 ≡ 8 – 4 ≤ 4 TRUE 2 x 4 – gcd (5,4) ≤ 5 ≡ 8 – 1 ≤ 5 FALSE Let us try frame size 5 2 x 5 – gcd (4,5) ≤ 4 ≡ 10 – 1 ≤ 4 FALSE Let us try frame size 10 2 x 10 – gcd (4,10) ≤ 4 ≡ 20 – 2 ≤ 4 FALSE Let us try frame size 20 2 x 20 – gcd (4,20) ≤ 4 ≡ 40 – 4 ≤ 4 FALSE
The other possible values for f ( as in eq 2) fails to fulfill equation 3. Thus, only the frame size 2 is suitable for scheduling.
What do the resulting cyclic scheduler tables look like (show the first 4 frame only) Start Time Jobs To Run T1.1, T3.1 1 2 T2.1 4 T1.2 3 6 T4.1
Even though in this example we could successfully find a suitable frame size that satisfies all the three equations, it is quite probable that a suitable frame size may not exist for many problems. In such cases, to find a feasible frame size we have to split the task ( or a few tasks) that is (are) causing violation of the equations into smaller sub-tasks that can be scheduled in different frames.