Mahe’s ‘Operating Systems’ Lessons (MOSLs)

Photo by engin akyurt on Unsplash


(This is going to be very short.)

An important term in the study of Operating Systems is ‘kernel’.
The kernel is the core of the operating system that has complete control over everything in it. When the computer system is turned on, the kernel of the OS is the first program to load onto the system.
Thus, the kernel facilitates the interactions between hardware and software.

The Dual Mode of Operation of The CPU

It is understood that the CPU operates in two different modes. Namely, the kernel mode and the user mode.

In the kernel mode, the executing code (the kernel) has complete access to the hardware. In kernel mode, the CPU can interrupt any process or reference any memory.
In user mode, the executing code (user program) has no direct access of the hardware.

In the user mode, the CPU runs a user program (text editor, paint etc.). Suppose an interrupt or exception occurs, then the CPU switches to kernel mode and from here the kernel decides how the exception/interrupt has to be handled. Once handled, the CPU again switches back to the user mode and the execution of user programs begins once more.

There are certain instructions which could alter some part of the OS, protected memory or I/O resources. These are called ‘privileged instructions’. To provide protection to the hardware, these instructions can only run in the kernel mode. If an attempt is made to execute a privileged instruction in user mode, it is treated as illegal.
Dual mode of operation hence provides a means to protect the OS and the hardware of the computer system from user programs that could cause harm.

In the next lesson we will discuss ‘system calls’ as a mechanism for the user program to request the OS to perform certain tasks (reserved for the OS) on its behalf.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store