Hello and welcome.
In this video session, we will have a small discussion on preemptive scheduling which is used in Linux
kernel.
The Linux kernel provides a preemptive based scheduler.
So let's see what is a preemptive scheduling.
Linux system supports Multi-process environment.
So there are many processes which are running parallelly and all the processes which are ready to be
run.
They are scheduled in such a manner that each process is given a time slice to be executed on the CPU.
So at any given point of time, only one process is active and holding the CPU.
The other process will be in ready to run state.
So once the time slice of the process is finished, the scheduler will preempt the running process with
another process which are in queue, and this is called as preemption.
The preemption happens in such a way that the process, which was running at the time of preemption,
stores its data and CPU registers on to the corresponding stack, and the new process starts to execute.
When the old process, which was pre-empted, is again scheduled by the scheduler,
It restores the data from the stack and then executes from the point where it had stopped the last instruction.
Now the Linux kernel prior to 2.6 was a non preemptive based scheduler.
This means.
Whenever a process is running in kernel mode.
For example, any system call which is running in a kernel mode, the process was in non preemptive
state.
That means a new process was not being able to preempt the old process until the old process voluntarily
voluntarily gives the CPU.
Post to 2.6.
Linux kernel preemptive based scheduling algorithm is used.
This means.
When a process is running in the kernel mode, and the scheduler can preempt the process running in
system.
The scheduler can preempt the process, which is running in kernel mode when the process is in safe
to preempt state and give the CPU time to the new process.
Hence, the Linux kernel Post 2.6 is considered as preemptive based scheduler.
In the next video session, we will learn about File descriptor table and open file table.
Thank you.