Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Maurice J. Bach

Rating No ratings yet

From the Back Cover In this timely new book, Maurice J. Bach traces the popularity of the UNIX system throughout the computer industry. The author describes the internal algorithms and structures that form the basis of the operating system (the kernel) and their relationship to the programmer interface. Among its key features, the book: Describes the outline of the kernel architecture Introduces the system buffer cache mechanism Includes data structures and algorithms used internally by the file system Covers the system calls that provide the user interface to the file system Defines the context of a process and investigates the internal kernel primitives that manipulate the process context Presents the system calls that control the process context Describes process scheduling Discussed memory management, including swapping and paging systems Outlines general driver interfaces, with specific discussion of disk drivers and terminal drivers Presents an overview of streams Introduces inter-process communication and networking, including System V messages, shared memory, and semaphores Explains tightly couples multiprocessor UNIX systems Investigates distributed UNIX systems

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
# The Design of the UNIX Operating System ## 【One-Line Pitch】 A classic deep-dive into the internal architecture of UNIX System V, explaining the kernel's algorithms and data structures—essential reading for systems programmers, OS students, and anyone who wants to truly understand how operating systems work under the hood. ## 【Book Arc】 - **Opening (~0%–9%)**: Traces UNIX's evolution from Bell Labs through System III and System V, contrasting with BSD variants, then introduces the kernel's two major subsystems—file and process—and the user perspective via the shell and fundamental system calls like fork, exec, and wait. - **Early (~9%–25%)**: Establishes kernel architecture fundamentals: the non-preemptive execution model, the buffer cache mechanism with its allocation algorithms (getblk), and how the kernel maintains data consistency through interrupt blocking and sleep states. - **Early–Middle (~25%–38%)**: Explores the internal representation of files—inodes, the super block, direct/indirect block addressing, and algorithms like iget, iput, bmap, and namei that convert path names to inodes and manage disk block allocation. - **Middle (~38%–47%)**: Details the system call interface to the file system: open, read, write, close, chroot, chown, chmod, stat, and dup—showing how file descriptors, file table entries, and inodes interconnect. - **Late (~47%–100%)**: Covers process control (fork, signals, exec, exit), scheduling and time, memory management (swapping and paging), device drivers, streams, inter-process communication (messages, shared memory, semaphores), and advanced topics in multiprocessor and distributed UNIX systems. ## 【Key Takeaways】 - **The kernel is non-preemptive** (Early): A process running in kernel mode executes until it sleeps or returns to user mode—this simple policy, plus interrupt blocking, maintains data structure consistency without complex locking. - **The buffer cache is the performance backbone** (Early): The getblk algorithm manages buffer allocation with hash queues and free lists, using delayed writes to reduce disk I/O—critical for understanding file system performance. - **Inodes are the heart of the file system** (Early): Every file has a unique inode containing ownership, permissions, size, and data block locations; the kernel converts path names to inodes via the namei algorithm. - **The super block caches free resources** (Early): Free inode numbers and free disk block numbers are cached in the super block, with a linked list of block numbers for overflow—a clever design that avoids expensive disk scans. - **File descriptors are indices into a layered table structure** (Middle): The user file descriptor table points to global file table entries, which point to inodes—this indirection enables features like dup and shared file offsets. - **Delayed write is especially effective for pipes** (Middle): By caching writes and deferring disk I/O, the kernel avoids redundant operations—particularly beneficial when data is written and quickly read or removed. - **The shell is just a user program** (Opening): UNIX keeps the kernel small by pushing compilers, editors, and the command interpreter to user space; the shell supports executable files, shell scripts, and internal commands as a programming language. - **The superuser is not a separate process class** (Early): Administrative processes use the same system calls as everyone else, distinguished only by special privileges—a design choice that simplifies the kernel. ## 【Reading Tips】 - **Skim the historical introduction** (~0%–6%): The UNIX lineage and popularity discussion is interesting context but not essential—move quickly to the kernel architecture overview. - **Deep-read the buffer cache and inode chapters** (~16%–34%): These are the conceptual foundations; the algorithms (getblk, iget, ialloc, bmap) appear repeatedly in later chapters, so mastering them pays off. - **Study the figures carefully**: Diagrams like the user/kernel stack layout and the inode direct/indirect block structure convey more than the prose—trace through the data structure relationships. - **Expect dense pseudocode**: The algorithm listings are simplified but still require careful reading; try tracing through scenarios (like buffer allocation with sleep/wakeup) to internalize the logic. - **Use later chapters as reference**: Process control, scheduling, and memory management build on earlier concepts—if you're primarily interested in processes, you can jump ahead after Chapter 5. ## 【Coverage Limits】 This guide covers the book's opening through the file system system calls (~47% of the book). The excerpts do not cover the later chapters on process control, scheduling, memory management, device drivers, streams, IPC, or multiprocessor/distributed systems in detail. ##
Page 9
9 MEMORY MANAGEMENT POLICIES 271 9.1 Swapping 272 9.2 Demand Paging 285 9.3 A Hybrid System With Swapping and Demand Paging . . 307 9.4 Summary 307 9.5 Exerc...
View in text
Excerpt 2
nel is non-preemptive, meaning that a process executing in kernel mode will continue to execute until it enters the sleep state or until it returns to execut...
View in text
Excerpt 3
ns the next mode number, allocates a free in-core mode for the newly assigned disk mode using algorithm iget (reading the mode from disk if necessary), copie...
View in text
Excerpt 4
"/") start from this Mode, and that all attempts to use ".." over the root will leave the working directory of the process in the new root. A process bestows...
View in text
Excerpt 5
icient, however, because another process could conceivably create a new directory somewhere in the file system and allocate the mode that had previously been...
View in text
Excerpt 6
of a process has a "static part" (first three items of the following list) and a "dynamic part" (last two items). A process has one static part of the system...
View in text
Excerpt 7
l copy of the context of the parent process. Since certain portions of a process, such as the text region, may be shared between processes, the kernel can so...
View in text
Excerpt 8
an executable file. The contents of the user-level context that existed before the exec call are no longer accessible afterward except for exec's parameters,...
View in text
Tags
AI categories
OSLinuxProgramming
ISBN: 0132017997
Publisher: Pearson
Publish Year: 1986
Language: English
Pages: 471
File Format: PDF
File Size: 6.5 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…