Day01 Notes
Day01 Notes
md 7/10/2023
Evaluation
Theory: 40 marks - MCQ (CCEE)
Lab: 40 marks - FreeRTOS
Internals: 20 marks
Pre-requisites
Operating System
Linux
C Programming
Computer fundamentals
RTOS
RTOS is OS in which accuracy of result is not only dependent on "correctness of the calculation", but
also depeneds on "time duration" in which results are produced.
Based on timing requirements there are three types of RTOS
Hard realtime OS
Soft realtime OS
Firm realtime OS
Characteristics of RTSO
Consistentency
Reliability
Predictability
1/6
Day01.md 7/10/2023
Performance
Scalability
Hard realtime OS
If interrupt/tasks deadline miss -- catastrophic effect.
Usually doesn't have secondary storage.
Timing: 10 to 100 "usec"
E.g. uC-OS, FreeRTOS, Xenomai, RTAI, ...
Soft realtime OS
Less time critical - If deadline miss, affect product quality (not catastrophic).
May have secondary storage
Timing: 1 ms to 10 ms
E.g. Linux (PREEMP_RT), ...
Firm realtime OS
Like hard realtime.
Rare miss of deadline is acceptable (not catastrophic).
Functions of RTOS
Task Management
Scheduling
Resource Allocation
Interrupt Handling
GPOS vs RTOS
GPOS vs RTOS -- Similiraties
1. Customization Support:
GPOS is little or no customizable (Linux is exception).
RTOS is fully customizable - so that it can be used with minimal memory.
2. Interrupt Latencies:
GPOS have higher interrupt latencies i.e. in msec.
RTOS handle interrupts in deterministic time and with lower latencies i.e. in usec.
3. IPC Latencies:
2/6
Day01.md 7/10/2023
CPU Scheduing
Process Life Cycle
Process States
New
3/6
Day01.md 7/10/2023
New process PCB is created and added into job queue. PCB is initialized and process get ready
for execution.
Ready
The ready process is added into the ready queue. Scheduler pick a process for scheduling from
ready queue and dispatch it on CPU.
Running
The process runs on CPU. If process keeps running on CPU, the timer interrupt is used to forcibly
put it into ready state and allocate CPU time to other process.
Waiting
If running process request for IO device, the process waits for completion of the IO. The waiting
state is also called as sleeping or blocked state.
Terminated
Types of Scheduling
Non-preemptive
The current process gives up CPU voluntarily (for IO, terminate or yield).
Then CPU scheduler picks next process for the execution.
If each process yields CPU so that other process can get CPU for the execution, it is referred as "Co-
operative scheduling".
Preemptive
The current process may give up CPU voluntarily or paused forcibly (for high priority process or upon
completion of its time quantum)
Scheduling criteria's
CPU utilization: Ideal - max
4/6
Day01.md 7/10/2023
* Time spent by the process in the ready queue to get scheduled on the CPU.
* If waiting time is more (not getting CPU time for execution) -- Starvation.
* Time from arrival of process (in ready queue) till allocated CPU for first time.
Scheduling Algorithms
FCFS
SJF
Priority
Each process is associated with some priority level. Usually lower the number, higher is the priority.
Preemptive scheduling or Non Preemptive scheduling
Starvation
Problem may arise in priority scheduling.
Process not getting CPU time due to other high priority processes.
Process is in ready state (ready queue).
5/6
Day01.md 7/10/2023
Round-Robin
Preemptive scheduling
Process is assigned a time quantum/slice.
Once time slice is completed/expired, then process is forcibly preempted and other process is
scheduled.
Min response time.
Fair-share
6/6