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

HW3R

assignment

Uploaded by

umer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

HW3R

assignment

Uploaded by

umer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Question 1:

Given that:
τ1={e1=3,p1=7}
τ2={e2=5,p2=16}
τ3={e3=3,p3=15}
Where:
ei: Execution time of task τi
pi: Period of task τi
Lets calculate the individual utilization:
ei
U i=
pi
For τ1:
3
U 1= ≈ 0.4286
7
For τ2:
5
U 2= ≈ 0.3125
16
For τ3:
3
U 3= ≈ 0.2
15
Now we will calculate the total utilization:
U =U 1+ U 2 +U 3

U =0.4286+0.3125+ 0.2=0.9411
For n=3 tasks, the RMS utilization bound is:
1
U RMS =3 ×(2 3 −1)≈ 0.779

Since U=0.9411>0.779, the task set does not satisfy the RMS utilization bound, meaning we cannot
guarantee schedulability solely based on this criterion.
To determine if the task set is schedulable under RMS, we will construct the schedule up to the least
common multiple (LCM) of the task periods.
Calculate hyper period:
LCM (7 ,16 ,15)=336
For simplicity, let’s construct the schedule from t=0 to t=50 and verify if tasks miss any deadlines.
According to RMS:

 τ1 (period 7) has the highest priority.


 τ2 (period 15) has the second highest priority.
 τ3 (period 16) has the lowest priority.

Based on the constructed schedule, all tasks meet their deadlines up to t=50. However, since the total
utilization is higher than the RMS bound, further testing beyond this interval would be required to
confirm schedulability over the hyperperiod. Nonetheless, this initial scheduling suggests the task set
may be schedulable with RMS, despite exceeding the RMS utilization bound.

Question 2:
Solution:
To verify the schedulability of the given task set under the Earliest Deadline First (EDF) algorithm,
we need to calculate the utilization and check if it satisfies the EDF schedulability condition.

Here, we have a task set with three tasks:


τ1≡{e1=1,p1=5,D1=4}
τ2≡{e2=2,p2=8,D2=6}
τ3≡{e3=1,p3=4,D3=3}

For EDF, a task set is schedulable if the total utilization 𝑈 of all tasks is less than or equal to 1:
n
ei
U =∑ ≤1
i=1 pi

Calculate total utilization 𝑈:


1 2 1
U = + + =0.7
5 8 4
Since U=0.7≤, the task set satisfies the EDF schedulability condition, meaning it is theoretically
schedulable under EDF.
To construct the schedule, we simulate each task up to the least common multiple (LCM) of the task
periods. The LCM of p1=5, p2=8, and p3=4 is:

LCM (5 ,8 , 4)=40
Thus, we’ll construct the schedule over a time span of 40 units.

Question 3:
Context-switching overhead refers to the time required by the CPU to switch from executing one
task to another. During a context switch, the operating system (OS) saves the state of the currently
running task and loads the state of the next task to be executed. This involves saving and restoring
CPU registers, program counters, and stack pointers, as well as updating other scheduling-related
data.
Context-switching overhead affects real-time systems because it consumes CPU time that could
otherwise be spent executing tasks, potentially impacting schedulability and system performance. In
real-time scheduling, failing to account for context-switching overhead could lead to missed
deadlines, especially in systems with high task-switching frequency or high overhead costs per switch.
In Rate-Monotonic Scheduling (RMS), tasks are assigned priorities based on their periods (shorter
periods get higher priorities). The schedulability of a task set is typically checked by calculating the
utilization bound.

For 𝑛 tasks in RMS, the utilization bound 𝑈 (without context-switching overhead) is:
1
n
U RMS ≤ n ×(2 −1)

The adjusted utilization for each task 𝜏i becomes:


e i +2.C s
U i=
pi
In Earliest Deadline First (EDF) scheduling, tasks are assigned priorities dynamically based on their
deadlines (tasks with earlier deadlines get higher priority). EDF can theoretically achieve 100% CPU
utilization without missing deadlines, but context-switching overhead reduces the available CPU time.
Under EDF, the system is schedulable if:
n
ei
U =∑ ≤1
i=1 pi
Thus, the adjusted utilization for EDF becomes:
n
ei +2. C s
U =∑ ≤1
i=1 pi
The task set is schedulable under EDF if this total utilization remains U≤1.

You might also like