Linux Operating System: History, Design, and Components - Prof. Michael W. Hicks, Study notes of Operating Systems

An overview of the linux operating system, including its history, design principles, and various components such as kernel modules, process management, and memory management. It also discusses the linux licensing model and the use of tools derived from other operating systems.

Typology: Study notes

Pre 2010

Uploaded on 02/13/2009

koofers-user-ca1
koofers-user-ca1 🇺🇸

9 documents

1 / 31

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Chapter 21: The Linux System
Chapter 21: The Linux System
21.2 Silberschatz, Galvin and Gagne ©2005
Operating System Concepts – 7th Edition, Feb 6, 2005
Chapter 21: The Linux System
Chapter 21: The Linux System
Linux History
Design Principles
Kernel Modules
Process Management
Scheduling
Memory Management
File Systems
Input and Output
Interprocess Communication
Network Structure
Security
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f

Partial preview of the text

Download Linux Operating System: History, Design, and Components - Prof. Michael W. Hicks and more Study notes Operating Systems in PDF only on Docsity!

Chapter 21: The Linux System Chapter 21: The Linux System

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 2 Silberschatz, Galvin and Gagne ©

Chapter 21: The Linux SystemChapter 21: The Linux System

 Linux History  Design Principles  Kernel Modules  Process Management  Scheduling  Memory Management  File Systems  Input and Output  Interprocess Communication  Network Structure  Security

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 3 Silberschatz, Galvin and Gagne ©

ObjectivesObjectives

 To explore the history of the UNIX operating system from which Linux is derived and the principles which Linux is designed upon  To examine the Linux process model and illustrate how Linux schedules processes and provides interprocess communication  To look at memory management in Linux  To explore how Linux implements file systems and manages I/O devices Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 4 Silberschatz, Galvin and Gagne ©

HistoryHistory

 Linux is a modern, free operating system based on UNIX standards  First developed as a small but self-contained kernel in 1991 by Linus Torvalds, with the major design goal of UNIX compatibility  Its history has been one of collaboration by many users from all around the world, corresponding almost exclusively over the Internet  It has been designed to run efficiently and reliably on common PC hardware, but also runs on a variety of other platforms  The core Linux operating system kernel is entirely original, but it can run much existing free UNIX software, resulting in an entire UNIX-compatible operating system free from proprietary code  Many, varying Linux Distributions including the kernel, applications, and management tools

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 7 Silberschatz, Galvin and Gagne ©

The Linux SystemThe Linux System

 Linux uses many tools developed as part of Berkeley’s BSD operating system, MIT’s X Window System, and the Free Software Foundation's GNU project  The min system libraries were started by the GNU project, with improvements provided by the Linux community  Linux networking-administration tools were derived from 4.3BSD code; recent BSD derivatives such as Free BSD have borrowed code from Linux in return  The Linux system is maintained by a loose network of developers collaborating over the Internet, with a small number of public ftp sites acting as de facto standard repositories Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 8 Silberschatz, Galvin and Gagne ©

Linux Distributions Linux Distributions

 Standard, precompiled sets of packages, or distributions, include the basic Linux system, system installation and management utilities, and ready-to-install packages of common UNIX tools  The first distributions managed these packages by simply providing a means of unpacking all the files into the appropriate places; modern distributions include advanced package management  Early distributions included SLS and Slackware  Red Hat and Debian are popular distributions from commercial and noncommercial sources, respectively  The RPM Package file format permits compatibility among the various Linux distributions

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 9 Silberschatz, Galvin and Gagne ©

Linux Licensing Linux Licensing

 The Linux kernel is distributed under the GNU General Public License (GPL), the terms of which are set out by the Free Software Foundation  Anyone using Linux, or creating their own derivative of Linux, may not make the derived product proprietary; software released under the GPL may not be redistributed as a binary-only product Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 10 Silberschatz, Galvin and Gagne ©

Design Principles Design Principles

 Linux is a multiuser, multitasking system with a full set of UNIX- compatible tools  Its file system adheres to traditional UNIX semantics, and it fully implements the standard UNIX networking model  Main design goals are speed, efficiency, and standardization  Linux is designed to be compliant with the relevant POSIX documents; at least two Linux distributions have achieved official POSIX certification  The Linux programming interface adheres to the SVR4 UNIX semantics, rather than to BSD behavior

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 13 Silberschatz, Galvin and Gagne ©

Components of a Linux System (Cont.) Components of a Linux System (Cont.)

 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 Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 14 Silberschatz, Galvin and Gagne ©

Kernel Modules 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 modules allow a Linux system to be set up with a standard, minimal kernel, without any extra device drivers built in  Three components to Linux module support:  module management  driver registration  conflict resolution

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 15 Silberschatz, Galvin and Gagne ©

Module Management Module Management

 Supports loading modules into memory and letting them talk to the rest of the kernel  Module loading is split into two separate sections:  Managing sections of module code in kernel memory  Handling symbols that modules are allowed to reference  The module requestor manages loading requested, but currently unloaded, modules; it also regularly queries the kernel to see whether a dynamically loaded module is still in use, and will unload it when it is no longer actively needed Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 16 Silberschatz, Galvin and Gagne ©

Driver RegistrationDriver Registration

 Allows modules to tell the rest of the kernel that a new driver has become available  The kernel maintains dynamic tables of all known drivers, and provides a set of routines to allow drivers to be added to or removed from these tables at any time  Registration tables include the following items:  Device drivers  File systems  Network protocols  Binary format

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 19 Silberschatz, Galvin and Gagne ©

Process Identity Process Identity

 Process ID (PID). The unique identifier for the process; used to specify processes to the operating system when an application makes a system call to signal, modify, or wait for another process  Credentials. Each process must have an associated user ID and one or more group IDs that determine the process’s rights to access system resources and files  Personality. Not traditionally found on UNIX systems, but under Linux each process has an associated personality identifier that can slightly modify the semantics of certain system calls  Used primarily by emulation libraries to request that system calls be compatible with certain specific flavors of UNIX Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 20 Silberschatz, Galvin and Gagne ©

Process EnvironmentProcess Environment

 The process’s environment is inherited from its parent, and is composed of two null-terminated vectors:  The argument vector lists the command-line arguments used to invoke the running program; conventionally starts with the name of the program itself  The environment vector is a list of “NAME=VALUE” pairs that associates named environment variables with arbitrary textual values  Passing environment variables among processes and inheriting variables by a process’s children are flexible means of passing information to components of the user-mode system software  The environment-variable mechanism provides a customization of the operating system that can be set on a per-process basis, rather than being configured for the system as a whole

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 21 Silberschatz, Galvin and Gagne ©

Process ContextProcess Context

 The (constantly changing) state of a running program at any point in time  The scheduling context is the most important part of the process context; it is the information that the scheduler needs to suspend and restart the process  The kernel maintains accounting information about the resources currently being consumed by each process, and the total resources consumed by the process in its lifetime so far  The file table is an array of pointers to kernel file structures  When making file I/O system calls, processes refer to files by their index into this table Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 22 Silberschatz, Galvin and Gagne ©

Process Context (Cont.) Process Context (Cont.)

 Whereas the file table lists the existing open files, the file-system context applies to requests to open new files  The current root and default directories to be used for new file searches are stored here  The signal-handler table defines the routine in the process’s address space to be called when specific signals arrive  The virtual-memory context of a process describes the full contents of the its private address space

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 25 Silberschatz, Galvin and Gagne ©

Relationship Between Priorities and Time- Relationship Between Priorities and Time-

slice Length slice Length

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 26 Silberschatz, Galvin and Gagne ©

List of Tasks Indexed by PriorityList of Tasks Indexed by Priority

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 27 Silberschatz, Galvin and Gagne ©

Real-time Process SchedulingReal-time Process Scheduling

 Linux implements the FIFO and round-robin real-time scheduling classes; in both cases, each process has a priority in addition to its scheduling class  The scheduler runs the process with the highest priority; for equal-priority processes, it runs the process waiting the longest  FIFO processes continue to run until they either exit or block  A round-robin process will be preempted after a while and moved to the end of the scheduling queue, so that round- robing processes of equal priority automatically time-share between themselves Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 28 Silberschatz, Galvin and Gagne ©

Kernel SynchronizationKernel Synchronization

 A request for kernel-mode execution can occur in two ways:  A running program may request an operating system service, either explicitly via a system call, or implicitly, for example, when a page fault occurs  A device driver may deliver a hardware interrupt that causes the CPU to start executing a kernel-defined handler for that interrupt  Kernel synchronization requires a framework that will allow the kernel’s critical sections to run without interruption by another critical section

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 31 Silberschatz, Galvin and Gagne ©

Interrupt Protection Levels Interrupt Protection Levels

 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  User processes can always be preempted by another process when a time-sharing scheduling interrupt occurs Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 32 Silberschatz, Galvin and Gagne ©

Symmetric MultiprocessingSymmetric Multiprocessing

 Linux 2.0 was the first Linux kernel to support SMP hardware; separate processes or threads can execute in parallel on separate processors  To preserve the kernel’s nonpreemptible synchronization requirements, SMP imposes the restriction, via a single kernel spinlock, that only one processor at a time may execute kernel- mode code

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 33 Silberschatz, Galvin and Gagne ©

Memory Management Memory Management

 Linux’s physical memory-management system deals with allocating and freeing pages, groups of pages, and small blocks of memory  It has additional mechanisms for handling virtual memory, memory mapped into the address space of running processes  Splits memory into 3 different zones due to hardware characteristics Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 34 Silberschatz, Galvin and Gagne ©

Relationship of Zones and Physical Relationship of Zones and Physical

Addresses on 80x86 Addresses on 80x

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 37 Silberschatz, Galvin and Gagne ©

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 38 Silberschatz, Galvin and Gagne ©

Virtual Memory 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:  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  A physical view of each address space which is stored in the hardware page tables for the process

Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 39 Silberschatz, Galvin and Gagne ©

Virtual Memory (Cont.) Virtual Memory (Cont.)

 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 Operating System Concepts – 7 th^ Edition, Feb 6, 2005 21. 40 Silberschatz, Galvin and Gagne ©

Virtual Memory (Cont.) Virtual Memory (Cont.)

 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  The kernel copies the parent process’s VMA descriptors, then creates a new set of page tables for the child  The parent’s page tables are copied directly into the child’s, with the reference count of each page covered being incremented  After the fork, the parent and child share the same physical pages of memory in their address spaces