Unit 2
Unit 2
-Nikhil Kumar
Basics
Basics
DUAL-MODE IN OPERATING SYSTEM
User mode (Non-Privileged mode) and Kernel mode (Privileged Mode):
Types of kernels
Let’s explore the different types of kernels in operating systems. Kernels are like the backstage magicians—
essential for making the whole show run smoothly! There are primarily two main types of kernels: monolithic
kernels and microkernels.
Monolithic Kernels
Structure: A monolithic kernel is a single, large executable file that contains all the core components of the operating
system, including device drivers, file systems, and memory management.
Advantages:
Efficient performance due to direct communication between kernel components.
Lower overhead compared to microkernels.
Easier to develop and maintain.
Disadvantages:
Less modular and flexible.
Difficult to update or replace individual components without recompiling the entire kernel.
Security risks due to a large, complex codebase.
Examples of operating systems with monolithic kernels: Linux, Windows, and macOS.
Microkernels
Structure: A microkernel is a small, modular kernel that provides basic services like process management, memory
management, and inter-process communication (IPC). Other components, such as device drivers and file systems, are
implemented as user-space processes or modules.
Advantages:
Highly modular and flexible.
Easier to update or replace individual components.
Improved security due to a smaller, simpler kernel.
Can be customized to specific hardware or application requirements.
Disadvantages:
Potential performance overhead due to the additional layer of abstraction.
More complex to develop and maintain.
Features:
Combination: Some services run in kernel space (like a monolithic kernel), while others stay in user space
(like a microkernel).
Flexibility: Balances performance and modularity.
o Traps are like secret doors in a house. When you open one, it leads you to a specific room with a purpose.
o What are Traps?
Traps are software-generated exceptions. They’re initiated by processes (user programs) within the operating system.
When a program encounters an error (like dividing by zero) or needs a specific OS service (like printing to the screen), it triggers
a trap.
Traps are synchronous—they happen during the execution of instructions.
o How Do Traps Work?
Let’s say your program wants to read a file. It calls a system call (a trap) to ask the OS for help.
The trap handler validates parameters, sets up data structures, and switches to supervisor mode.
The relevant kernel procedure (like “Read File”) executes, and the OS provides the requested service.
Afterward, the CPU returns to the user program.
o Example:
You write a program that divides two numbers. If the second number is zero, a trap occurs (division by zero error). The trap
handler deals with it.
Or, you ask the OS to print “Hello, World!” The program triggers a trap, and the OS handles the printing.
Basics
Basics
OS
Booting of an Operating System: A Step-by-Step Guide
Booting is the process by which a computer system starts up after being powered on. It involves a sequence of actions that load
the necessary software and hardware components to initialize the operating system.
2.BIOS Initialization:
1. The BIOS loads its own program into memory.
2. It configures the system's basic settings, such as the date, time, and input/output devices.
Types of Booting
•Cold Boot: This is the initial startup process when the computer is powered on.
•Warm Boot: A warm boot, also known as a restart, is when the computer is restarted while it's already running. This
process is typically initiated by the user or the operating system itself.
Note: The specific steps and the exact sequence may vary depending on the computer's hardware, BIOS, and
operating system. However, the general process remains consistent across most systems.
Process Management in OS
• A Program does nothing unless its instructions are executed by a CPU. A program in execution is
called a process.
• There may exist more than one process in the system which may require the same resource at the same time.
Therefore, the operating system has to manage all the processes and the resources in a convenient and
efficient way.