Operating Systems and Kernels

 

Operating Systems and Kernels

An operating system (OS) is not simply what users see on the screen, such as windows, icons, or menus. Although many users think of the graphical interface as the operating system, this view is technically incomplete.

What Is an Operating System?

In a technical sense, the operating system consists of the essential components required for the basic use and administration of a computer system. These include:

  • The kernel

  • Device drivers

  • Boot loader

  • Command shell or other user interfaces

  • Basic system and file utilities

Applications such as web browsers, media players, or games are not part of the operating system.
The term system refers to the operating system plus all applications running on top of it.


The Kernel: Core of the Operating System

The kernel is the innermost and most critical part of the operating system. While the user interface is the outer layer, the kernel forms the core internals of the system.

The kernel is responsible for:

  • Managing hardware resources

  • Providing basic services to all programs

  • Controlling access to the CPU, memory, and devices

Because of this central role, the kernel is also called the core, supervisor, or internals of the operating system.


Main Functions of the Kernel

Typical kernel components include:

  • Interrupt handlers to respond to hardware events

  • A scheduler to share processor time among processes

  • Memory management to control process address spaces

  • System services such as networking and interprocess communication (IPC)


Kernel Space and User Space

Modern operating systems use hardware protection to separate execution into two modes:

Kernel Space (Kernel Mode)

  • Kernel code executes here

  • Full access to hardware and memory

  • Runs with elevated privileges

User Space (User Mode)

  • User applications execute here

  • Limited access to system resources

  • Cannot directly access hardware or kernel memory

This separation improves security, stability, and fault isolation.


System Calls: Communication with the Kernel

Applications interact with the kernel through system calls.

  • Applications usually invoke library functions (such as the C library)

  • These library functions may internally use system calls to request kernel services

Examples:

  • printf() performs formatting and buffering, then calls write()

  • open() maps almost directly to the open() system call

  • Some functions (e.g., strcpy()) do not require kernel involvement

When a system call is executed:

  • The kernel runs on behalf of the application

  • The kernel executes in process context

This system call interface is the fundamental mechanism through which applications get work done.


Interrupt Handling

The kernel also manages hardware using interrupts:

  • Hardware devices generate interrupts to signal events

  • Each interrupt has an associated interrupt handler

  • The kernel executes the appropriate handler to respond

Example:

  • A keyboard interrupt notifies the kernel of new input

  • The kernel reads the data and signals readiness for more input

Interrupt handlers run in a special interrupt context, not associated with any process.
This context allows the kernel to respond quickly to hardware events.


Three Execution States of the CPU

At any moment, a processor is executing exactly one of the following:

  1. User-space: running user code in a process

  2. Kernel-space (process context): executing kernel code on behalf of a process

  3. Kernel-space (interrupt context): handling a hardware interrupt

Even when the system is idle, the kernel is executing an idle process in kernel mode.


Key Takeaway

  • The operating system provides the essential environment for program execution

  • The kernel is the heart of the operating system

  • User applications rely on the kernel through system calls

  • Hardware interaction occurs via interrupts

  • Clear separation of user space and kernel space ensures safety and efficiency


📌  Summary 

The kernel is the privileged core of the operating system that manages hardware, resources, and system services, enabling applications to run safely and efficiently.



 

Comments

Popular posts from this blog

Operating Systems OS PCCST403 Semester 4 BTech KTU CS 2024 Scheme

Introduction to Operating System -Virtualization, Concurrency, and Persistence

Operating Systems PCCST403 Scheme and Syllabus