Operating Systems: Module - 5b Case Study: The Linux Operating System
Operating Systems: Module - 5b Case Study: The Linux Operating System
Operating Systems: Module - 5b Case Study: The Linux Operating System
Like most UNIX implementations, Linux is composed of three main bodies of code; the
most important distinction between the kernel and all other components
The kernel is responsible for maintaining the important abstractions of the operating system
o Kernel code executes in kernel mode with full access to all the physical resources of
the computer
o All kernel code and data structures are kept in the same single address space
The system libraries define a standard set of functions through which applications interact
with the kernel, and which implement much of the operating-system functionality that does
not need the full privileges of kernel code
The system utilities perform individual specialized management tasks
5.4 Kernel Modules
Sections of kernel code that can be compiled, loaded, and unloaded independent of the rest
of the kernel
A kernel module may typically implement a device driver, a file system, or a networking
protocol
The module interface allows third parties to write and distribute, on their own terms, device
drivers or file systems that could not be distributed under the GPL
Kernel Synchronization
A request for kernel-mode execution can occur in two ways:
o A running program may request an operating system service, either explicitly via a
system call, or implicitly, for example, when a page fault occurs
o A device driver may deliver a hardware interrupt that causes the CPU to start
executing a kernel-defined handler for that interrupt
Each level may be interrupted by code running at a higher level, but will never be
interrupted by code running at the same or a lower level
Virtual Memory
The VM system maintains the address space visible to each process: It creates pages of
virtual memory on demand, and manages the loading of those pages from disk or their
swapping back out to disk as required
The VM manager maintains two separate views of a process’s address space:
o A logical view describing instructions concerning the layout of the address space
The address space consists of a set of nonoverlapping regions, each
representing a continuous, page-aligned subset of the address space
o A physical view of each address space which is stored in the hardware page tables
for the process
Virtual memory regions are characterized by:
The backing store, which describes from where the pages for a region come; regions are
usually backed by a file or by nothing (demand-zero memory)
The region’s reaction to writes (page sharing or copy-on-write)
The kernel creates a new virtual address space
1. When a process runs a new program with the exec system call
2. Upon creation of a new process by the fork system call
On executing a new program, the process is given a new, completely empty virtual-address
space; the program-loading routines populate the address space with virtual-memory regions
Creating a new process with fork involves creating a complete copy of the existing
process’s virtual address space
Block Devices
Provide the main interface to all disk devices in a system
The block buffer cache serves two main purposes:
o it acts as a pool of buffers for active I/O
o it serves as a cache for completed I/O
The request manager manages the reading and writing of buffer contents to and from a
block device driver