Tuesday 7 February 2012

anatomy of Operating system

The operating system is used for maintaining and managing the resource of the system,something like an administrator maintaining the resources.
There typically exists two spaces for usage namely the kernel and user space,this allows the OS to differentiate between reliable and non reliable processes.The reliable process being the system processes which are run in kernel mode ,thus these processes have access to hardware and various resources.
The user processes such as those which you use,like a browser for instance are in user space as these are not reliable.They may contain malicious codes or may contain bugs.These user processes are run in user space (There exist separate virtual memory for user and kernel modes processes) Thus eventually for these user processes to run they need to be mapped to kernel processes .There exist various schemes of mapping wherein many user processes can be mapped to a single kernel process or they may be mapped to many kernel processes.
The kernel is just the core constituent of the  OS ,This provides to each of the application which may contain multiple threads (threads are something like a small process or small app) thus each user application can only run when the kernel provides these threads.
However what would happen if the user thread (an application is composed of set of small threads each doing some stuff as was earlier declared) gets blocked (if a thread requires access to resources say a printer but if the resource is being used by another ,then it got to wait or get blocked) ?
The kernel by means of a mechanism termed the "upcall" will indicate to the user application that a thread is being blocked and also allows the kernel thread which was mapped to the user thread ,to be used for some other user thread which can be run!
The reason of kernel and user space is ,to reiterate it safeguards the resources so that the OS can allow all privileges to the recognised and reliable processes which are termed the kernel processes and those which it is not sure of is implemented in the userspace
Generally all the system process such as scheduler,dispatcher etc are the kernel processes and the normal applications such as the time display,GUI apps etc are the user processes.




so in summary for a easier understanding of operating system ,consider the existence of two domains ,the usersmode and the kernel mode..All the important ,reliable processes which are responsible for critical system performance are kept as kernel processes and those which are not are the user processes .
Thus if a user process becomes unstable then it just gets hanged and you may need to do the alt+ctrl+del to kill it.But if any of the kernel process gets corrupted then you the whole operating system come to a halt and the only option is to reboot and install a new OS !!!!
so to avoid all the user process to directly get hold of hardware the OS will map the user process to kernel process and this kernel process actually runs in the system.

No comments:

Post a Comment