# Lecture Topic: Real Time CPU scheduling

**Material up to 5.27 on the slides will be on the midterm**

Multilevel Feedback Queue:
A process can move between multiple queues
Get from slides (?)


Real Time CPU scheduling
Can present challenges
Soft real time systems: Critical real time tasks have the highest priortiy but there are no guarantees
Hard real time systems: Tasks need to be scheduled first (?)

Event Latency: The amount of time that elapses from when an event occurs to when it is serviced
Two types of latency's affect performance:
- Interrupt latency
- Dispatch Latency

Dispatch latency conflicts:
- You need to preempt any processes running in kernel mode
- Release by low priority processes of resource needed by high priority processes

Priority based scheduling:
For real time scheduling, you need to support preemptive, priority based scheduling, but this only guarantees soft real time
For hard real time, must also provide ability to meet deadlines:
Processes have new characteristics, periodic ones require CPU at constant intervals:
- has processing time t, deadline of d, and a period p
- 0 < t < d < p
- rate of period task is 1/p


Rate monotonic Scheduling:
A priority is assigned based on the inverse of its period.
Shorter periods = higher priority
longer periods = lower priority

Earliest deadline first:
Priorities are assigned according to deadlines:
The earlier the deadline, the higher the priority
The later the deadline, the lower the priority

Algorithm Evaluation:
(?)


# **Midterm Review:**

Midterm is balanced:
Applying tools relevant to concepts
Answering theory questions
About 60% of the grade is theory (no coding)
50 minutes

Understanding the labs and stuff under misc. in d2l should be enough

Topics to review:
Slides (Chapter 1 to Chapter 5, until rate monotonic scheduling)
Lab 2 and Lab 3
A1 and A2
Content of the misc. useful stuff folder
Scheduling, metrics
Materials occurring multiple times in the lectures

How to answer if you don't know
If you remember the book answer - use that
answer in your own words if you are trying to explain a concept
the book is the most reliable source

What would the output of the following function will probably be on the midterm