1. Home
  2. Explore
  3. Computer Science
  4. Operating System Components

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Operating System Components

Operating-System Components, Kernel Functions, and Kernel Types

The Two Main Components of an Operating System

An operating system can be viewed as two broad areas: user space and the kernel. They have different responsibilities and different levels of access to the computer’s hardware.

User space

User space is the area in which user applications and many system utilities run. It provides an environment for people to use applications and for developers to create and run them.

  • Applications such as editors, browsers, and games generally run in user space.

  • User-space programs normally do not access hardware directly. They request operating-system services when they need protected resources or hardware operations.

  • User space includes the interfaces through which people interact with a computer, such as graphical and command-line interfaces.

Kernel

The kernel is the central part of an operating system. It mediates between software and hardware and carries out important system-management tasks.

  • The kernel has privileged access to hardware and manages access to resources such as processors, memory, storage, and I/O devices.

  • When an application needs an operation that it cannot perform directly, it requests the kernel to perform it.

  • The kernel starts early in the operating system’s startup process and initializes essential system facilities.

User-space programs request services; the kernel manages those requests and coordinates the hardware operations needed to fulfill them.

A simplified relationship is:

  1. A user or application initiates an operation in user space.

  2. The application requests an operating-system service.

  3. The kernel performs or coordinates the operation using hardware.

  4. The result is returned to the application.


User Interfaces: GUI, CLI, and Shells

A user interface lets a person interact with the operating system. Two common forms are the graphical user interface and the command-line interface.

Graphical user interface

A graphical user interface (GUI) presents visual elements such as windows, icons, menus, buttons, and pointers. Users typically interact with it using a mouse, touch screen, or keyboard.

For example, creating a folder through a GUI might involve opening a file manager and selecting a “New Folder” command.

Command-line interface

A command-line interface (CLI) accepts text commands. The user types a command, and a command interpreter processes it.

For example, the command mkdir is commonly used on Unix-like systems to create a directory. The command interpreter processes the request, and operating-system services carry out the file-system operation.

Shell

A shell is a program that provides a command-line environment by accepting commands and arranging for them to be executed. A terminal is the interface or application through which a user can interact with a shell; the two terms are related but do not mean exactly the same thing.

The particular CLI program varies by operating system. Examples include PowerShell on Windows and shells commonly used through terminals on Linux and macOS.

GUI and CLI compared

  • GUI: Users choose actions through visual controls.

  • CLI: Users express actions as typed commands.

  • Both can provide access to many of the same underlying operating-system capabilities. A GUI action often triggers software that ultimately requests operating-system services, just as a CLI command does.

For example, creating a folder through a GUI or entering a directory-creation command in a CLI may lead to the same kind of file-system operation. The interface differs; the underlying request is handled by system software.


How an Application Request Reaches Hardware

Consider a shell script that prints “Hello, world.” When a user runs the script, the shell and other user-space software interpret and execute its instructions. If the task requires work controlled by the operating system—such as writing output to a device—the program requests an appropriate service.

The kernel then coordinates the required operation. For example, it may arrange for the processor to execute instructions or for output to be sent to a display device. The application does not normally control the hardware directly; the kernel provides the controlled route between software and hardware.

This illustrates the layered relationship:

  • Application or shell: Initiates the task in user space.

  • Kernel: Provides protected system services and manages resources.

  • Hardware: Performs operations under the operating system’s control.


Kernel Functions

The kernel performs several major functions. Four broad categories are process management, memory management, I/O management, and file management.

1. Process management

A process is a program in execution, together with the state and resources needed to run it. The kernel manages processes throughout their lifetimes.

Process-management responsibilities include:

  • Process creation and termination: Starting processes and ending them when their work is complete or they are stopped.

  • Scheduling: Selecting which process or thread should run and when, so the processor is shared among competing tasks.

  • Synchronization: Coordinating processes or threads that need to share resources or avoid conflicting operations.

  • Interprocess communication: Providing ways for processes to exchange data or coordinate their work.

  • Context switching: Saving the execution state of one process or thread and restoring the state of another so the processor can switch tasks.

Scheduling policies aim to use resources effectively while meeting system goals. Depending on the system, those goals may include responsiveness, fairness, priorities, or throughput. A system may also seek to avoid starvation, in which a process waits indefinitely because other work is continually chosen instead.

2. Memory management

Memory management controls the allocation and use of main memory, such as RAM.

The kernel’s responsibilities include:

  • Allocating memory to processes and reclaiming it when it is no longer needed.

  • Tracking which memory areas are in use and which are available.

  • Protecting one process’s memory from unauthorized access by another process.

  • Coordinating memory use so that multiple processes can run without incorrectly overwriting one another’s data.

Tracking free memory is essential. When a process ends or releases memory, the operating system needs to recognize that the space can be reused.

3. I/O management

Input/output (I/O) management coordinates communication with devices such as keyboards, displays, storage devices, printers, and USB devices.

When a device is connected, the operating system may detect it, make it available through suitable software, and notify the user or applications. The kernel coordinates device operations and provides controlled ways for programs to use devices.

Three related techniques are buffering, caching, and spooling:

  • Buffering: Temporarily holds data while it is being transferred or processed. It can help manage differences in the rates at which parts of a system produce and consume data. For instance, a media player may buffer data so playback can continue smoothly while more data arrives.

  • Caching: Keeps copies of frequently or recently used data in a faster-access location so that later requests can be served more quickly.

  • Spooling: Queues work for a device or service that processes requests more slowly than they arrive. Print spooling is a common example: print jobs are placed in a queue or storage area so that a printer can process them one at a time.

These techniques address different needs: buffering supports data transfer, caching speeds up repeated access, and spooling organizes queued work.

4. File and directory management

File management provides operations for creating, reading, modifying, organizing, and deleting files. Directory management organizes files into a structure that users and applications can navigate.

Many file systems arrange directories hierarchically, like a tree:

  • The hierarchy begins at a root directory.

  • Directories can contain files and other directories.

  • A file can be located by following a path through the hierarchy.

For example, a directory under the root might contain a user’s folder, which in turn contains other folders and files. A hierarchical organization makes it possible to group related files and locate them by traversing a path from the root.


User Mode, Kernel Mode, and Interrupts

Operating systems commonly distinguish between user mode and kernel mode. These modes provide different levels of privilege.

User mode

Programs normally run in user mode, where access to protected hardware and kernel resources is restricted. This limits the damage a faulty or malicious application can cause.

Kernel mode

The kernel runs in kernel mode, which grants it privileged access needed to manage hardware and system resources. Because kernel-mode operations can affect the whole system, they require careful control.

Switching between modes

When a user-space program needs a protected operating-system service, execution can transfer from user mode to kernel mode. After the kernel handles the request, control usually returns to user mode.

For example, a command to create a directory begins in a shell running in user space. The shell or a related program requests a file-system operation. The kernel checks and performs the operation, then reports the result.

A mode switch changes the processor’s privilege level. It is distinct from a context switch, which changes the currently running process or thread. A system call or interrupt can cause a mode switch without necessarily switching to a different process.

Interrupts and system requests

An interrupt is a signal that causes the processor to pause its current flow of execution and handle an event.

  • Hardware interrupts are raised by hardware devices to report events, such as a device needing attention.

  • Software-generated events can request operating-system attention. A program uses a system-call mechanism to ask the kernel to perform a protected service.

The exact mechanism used to enter the kernel depends on the processor and operating system. The important point is that user programs use controlled entry points rather than directly performing privileged kernel operations.


Types of Kernels

Kernel designs differ in how much operating-system functionality runs inside the kernel and how much runs in user space. Three broad designs are monolithic, microkernel, and hybrid kernels.

1. Monolithic kernel

A monolithic kernel places most major operating-system services in kernel space. These commonly include process management, memory management, file-system services, and I/O or device management.

Advantages

  • Efficient communication: Services within the kernel can communicate directly through internal mechanisms, reducing the need to cross between user space and kernel space for every interaction.

  • Potentially high performance: Fewer boundary crossings can reduce the overhead involved in coordinating services.

Disadvantages

  • Large kernel: Many services reside in the privileged part of the operating system.

  • Reliability concerns: A defect in a kernel component can affect other kernel components or the whole system because they share a highly privileged environment.

Linux and traditional Unix systems are commonly described as monolithic-kernel designs, although modern kernels can include modular features. MS-DOS is also often cited as an example in introductory comparisons, but its design and capabilities differ substantially from those of modern protected operating systems.

2. Microkernel

A microkernel keeps a relatively small set of essential functions in kernel space and moves many other services into user-space processes. The exact division varies by design. Essential kernel responsibilities often include low-level process and memory functions, while services such as device drivers or file-system services may be placed outside the kernel.

Advantages

  • Smaller privileged core: Fewer services run with kernel-level privileges.

  • Potentially greater reliability and stability: A failure in a user-space service may be less likely to bring down the entire kernel.

  • Modularity: Services can be separated into components with clearer boundaries.

Disadvantages

  • Communication overhead: Services may need to exchange requests and results across the user–kernel boundary.

  • Potential performance cost: Repeated communication and mode transitions can add time, especially when many services must cooperate on one task.

A program may require several services—for example, process coordination, memory allocation, file access, and device I/O. If those services are separate and communicate through kernel-mediated messages, their coordination can add overhead. The size of the performance cost depends on the implementation.

Examples commonly associated with microkernel designs include MINIX and the L4 family. Symbian is also often discussed in introductory comparisons of microkernel-based operating systems.

3. Hybrid kernel

A hybrid kernel combines ideas from monolithic and microkernel designs. It aims to balance performance, modularity, and reliability. The precise arrangement differs among operating systems; there is no single required set of services that every hybrid kernel must place in kernel space or user space.

A hybrid design may keep performance-sensitive services in kernel space while separating or modularizing other services. The goal is to retain efficient communication where it matters while limiting the size or interdependence of the kernel.

  • Potential benefits: A design may combine efficient kernel-level interaction with greater modularity than a fully monolithic arrangement.

  • Trade-offs: The design still has to balance kernel complexity, communication costs, and the consequences of component failures.

Windows NT and macOS are often described as using hybrid-kernel approaches. The labels are broad classifications; actual architecture details vary by operating-system version and implementation.

Comparing the designs

  • Monolithic: Many operating-system services run in kernel space. Internal communication can be efficient, but the kernel is larger and failures may have broader effects.

  • Microkernel: The kernel contains a smaller core, with many services outside it. This can improve separation and fault isolation, but service communication may add overhead.

  • Hybrid: The design combines techniques from the other approaches in an effort to balance speed, modularity, and stability.


Interprocess Communication (IPC)

Processes are generally isolated from one another: each process has its own execution state and protected resources. Interprocess communication (IPC) provides mechanisms for processes to exchange information or coordinate their activity.

IPC can be needed between processes running in user space, between system services, or across user-space and kernel-space components. The specific mechanism depends on the operating system and the relationship between the communicating components.

Shared memory

With shared memory, two or more processes are given access to a common memory region.

  1. One process writes data into the shared region.

  2. Another process reads that data from the same region.

  3. The processes coordinate access so that they do not read incomplete data or overwrite one another’s work.

Shared memory can support fast data exchange because processes access a common region rather than sending every piece of data through a separate message. It requires synchronization to manage concurrent access safely.

Message passing

With message passing, processes exchange data through messages sent over a communication mechanism, such as a channel or pipe. Operating-system services may provide the operations used to send and receive those messages.

Message passing keeps the exchange explicit: one process sends a message, and another receives it. It is useful when processes should remain more separate or when data is exchanged as discrete requests and responses.

System calls

A system call is a controlled request by a program for a service provided by the operating system. System calls can support operations such as file access, process control, or communication. They provide a standard way for user-space programs to request services that require kernel involvement.

Shared memory and message passing are two important IPC approaches, and operating systems may support both. Their suitability depends on factors such as the amount of data being exchanged, the desired separation between processes, and the need for synchronization.


Key Ideas to Remember

  • The operating system can be understood as user space, where applications and interfaces run, and the kernel, which manages protected resources and hardware.

  • A GUI and a CLI are different ways to request actions; both ultimately rely on operating-system services for protected operations.

  • The kernel’s main responsibilities include process management, memory management, I/O management, and file and directory management.

  • User mode restricts access to protected resources, while kernel mode gives the kernel the privileges needed to manage the system.

  • Monolithic, microkernel, and hybrid designs differ mainly in how they distribute operating-system services between kernel space and user space.

  • IPC enables isolated processes to exchange information, commonly through shared memory or message passing.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent