February 5, 2015

Tips for Linux Kernel scheduling,shutdown and restart command,steps to kernel updating

 kernel scheduling in Linux

In kernel you have kernel threads. Some part of the kernel code runs in the userspace process context and some other part runs in the kernel thread context. All the userspace processes and kernel threads are scheduled with no difference except that their priority(that is both userspace process and kernel threads are treated same).

we can change the kernel with our algorithm.. algorithm in sence round robin,shortest job first, fcfs, etc.
You have a mirror or some part (dono the exact name) in kernel where you store your algorithm. and make kernel work in your algorithm. If your algorithm works fine without crashing the system you can set ur algorithm as default overwriting the existing one.
Its possible to write your own algorithm too.

scheduler schedules processes either it may be user or kernel, all user and kernel processes are same and kernel treats them in the same manor,except kernel process will not be swapped out, kernel process will have more privilege than user process, and at the same time it will have lot of limitation, they cannot use memory like a user process .

There is no separate scheduler for kernel processes.

And when scheduler will come into picture?, when ever you create a process, at every timer (PIT) interrupt, process been woken up by an event.

I think u have confused kernel means not only scheduler, all the subsystems in side it called kernel. Ex: interrupt manager, memory manager.

When a process needs some resource then the corresponding subsystem will come into picture, for example: process calls malloc, who will give the memory to it. the manager managing memory resource will give some free memory to it, it is also part of the kernel.

I think u need to read basics of Operating systems, kernel preemption is different, and process preemption it not called preemption we have to call them process switching. Process switching depends on the scheduling algorithm.

all processes which uses kernel will be effected by preemption, with out kernel there wont be any process.

System command to shutdown a system and for restart on Linux

Following is very important System command to shutdown a system and for restart on Linux. I tried both command and its correct. 

init 0 for shutdown

init 6 for reboot

Please note that command shutdown -h also used to shutdown the system but  shutdown -h can executed by any user but init 0 can only run by superuser .

The steps to kernel updations on Linux

The steps to kernel updating.
first of all download the kernel from kernel.org latest version
then untar it by using
# tar -zxvf linux-2.6.30.tar.gz
after that go to parent dictory of kernel
#make menuconfig
#make modules
#make modules_install
#make install
After that you reboot it , you get updated kernel at grub and select it .Then you will get updated version of kernel