- There is one hardware timer that generates interrupts every 10ms and all the software timer synchronizes with it.
- Usually the timer stored in the variable jiffies.
unsigned long volatile jiffies;
The variable jiffies is modified by the timer interrupt every 10ms and hence it is declared as volatile.
volatile struct timeval xtime:
This is the actual time which again modified by the timer interrupt
Other functions of timer interrupt like
updates the jiffies
updates the timer and processing of the timer related functions
collects data for the scheduler and decides whether it has to be scheduled.
schedule () is function declared in kernel/sched.c
The actions of the scheduler is given below, once the schedule() function is called,
- Upcoming software interrupts are processed (so interrupts are given higher priority over the other entities in the system)
- process with highest priority determined (if two tasks has equal priority, then the OS will determine which task to be executed first.)
- real time process takes over normal ones. (Real time processes area associated with deadlines, whereas the normal ones doesn’t have deadlines, this factor is determined by the rt_priority of the schedule structure)
- new process becomes current process. (whenever a process is getting scheduled by the scheduler, then it will become the current process)