0% found this document useful (0 votes)
8 views

Unit 2

The document discusses the dual-mode operation in operating systems, explaining user mode and kernel mode, and details the different types of kernels: monolithic, microkernels, and hybrid kernels, along with their advantages and disadvantages. It also covers interrupts and traps, defining their roles and how they function within the OS. Additionally, the document outlines the booting process of an operating system, including steps like POST, BIOS initialization, and loading the kernel.

Uploaded by

kumarajendar620
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Unit 2

The document discusses the dual-mode operation in operating systems, explaining user mode and kernel mode, and details the different types of kernels: monolithic, microkernels, and hybrid kernels, along with their advantages and disadvantages. It also covers interrupts and traps, defining their roles and how they function within the OS. Additionally, the document outlines the booting process of an operating system, including steps like POST, BIOS initialization, and loading the kernel.

Uploaded by

kumarajendar620
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Process Management

-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.

Examples of operating systems with microkernels: QNX, Mach, and Singularity.


Hybrid Kernels
Some operating systems combine elements of monolithic and microkernel architectures. For example, the Linux
kernel incorporates some microkernel-like features, such as loadable modules for device drivers and file systems.

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.

The choice of kernel type depends on various factors, including:


 Performance requirements: Monolithic kernels are generally more efficient, while microkernels can be more
flexible.
 Security considerations: Microkernels can offer improved security due to their modular design.
 Development and maintenance costs: Monolithic kernels are often easier to develop and maintain, while
microkernels can be more complex.
Basics
Interrupts:
o Imagine you’re at a busy intersection, and suddenly a police officer raises their hand, signaling you to stop. That’s an interrupt—a
signal that demands immediate attention.
o What are Interrupts?
 Interrupts are events triggered by either hardware or software. They’re like digital taps on the shoulder, saying, “Hey, CPU, pay
attention!”
 Hardware interrupts come from external devices (like keyboards, network cards, or timers). When your keyboard registers a
keypress, it sends an interrupt.
 Software interrupts (also called traps) are generated by user programs. They’re like polite requests to the operating system:
“Hey, OS, can you do something for me?”
o How Do Interrupts Work?
 When an interrupt occurs, the CPU pauses its current task, saves its state (registers, program counter, etc.), and switches to a
special mode called supervisor mode (or kernel mode).
 The interrupt handler (a piece of code) takes over. It’s like the police officer directing traffic. For hardware interrupts, this
handler deals with the external event (e.g., reading data from the keyboard).
 Once done, the CPU returns to what it was doing before—the original program continues.
o Example:
 You’re playing a game, and your friend presses a key on the keyboard. The keyboard sends an interrupt signal. The CPU stops
the game, runs the keyboard interrupt handler, and registers the keypress. Then it goes back to the game.
 It’s like the game paused briefly for that keyboard input.
Basics
Traps:

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.

The Booting Process:

1.Power-On Self-Test (POST):


1. When you turn on the computer, the BIOS (Basic Input/Output System) performs a thorough check of the hardware
components.
2. It verifies the CPU, RAM, hard drive, and other peripherals.
3. If any errors are detected, the BIOS will display an error message and halt the booting process.

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.

3.Loading the Bootloader:


1. The BIOS searches for the bootloader, which is typically stored on a hard drive or other storage device.
2. The bootloader is a small program that loads the operating system's kernel into memory.
1.Loading the Operating System Kernel:
1. The bootloader transfers the kernel, the core of the operating system, into memory.
2. The kernel initializes the system's hardware, sets up memory management, and starts the device drivers.
2.Starting the Operating System:
1. Once the kernel is loaded, it starts the operating system's processes and services.
2. The operating system loads the necessary drivers and programs to interact with the hardware and provide a
user interface.

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.

You might also like