Linux Case Study
Linux Case Study
Outline
• Linux History
• Design Principles
• Interprocess Communication
History of Linux
Linus Torvalds
5% 7%
11% 19%
17%
60% 81%
Design principles
• Its file system adheres to traditional UNIX semantics, and it fully implements
the standard UNIX networking model
• The Linux kernel is distributed under the GNU General Public License (GPL),
as defined 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 must
include its source code”
Linux kernel vs Linux distributions
• A Linux distribution is the kernel plus the software needed to make the
system actually usable
• user interface, libraries, all user level programs, etc
• Linux separates user and kernel mode to provide protection and abstraction
• The OS functionality is split between the main Linux Kernel and optional
kernel modules
• Linux Kernel - all code that is needed as soon as the system begins: CPU
scheduler, memory managers, system call / interrupt support, etc
• A monolithic kernel - benefits?
• Can specify whether each OS component is compiled into the kernel or built
as a module, if you build your own version of Linux from source code
Kernel Modules
• Kernel must resolve conflicts if two modules try to access the same device,
or a user program requests functionality from a module that is not loaded
Process management
Process identity
• Credentials - information such as the user who started the process, their
group, access rights, and other permissions info
Process environment
• Argument Vector - list of parameters passed to the program when it was run
• head -n 20 file.txt -- start the “head” program with 3 arguments
Process context
• Scheduling context - all of the data that must be saved and restored when a
process is suspended or brought into the running state
• The Linux scheduler must allocate CPU time to both user processes and
kernel tasks (e.g. device driver requests)
Caches
• Caches can significantly improve the speed of I/O at the expense of RAM
• Linux automatically resizes the buffer and page caches based on how
much memory is free in the system
File Systems
• Virtual File System layer provides a standard interface for file systems
• Supports inode, file, dentry, and superblock objects
• Lets the OS treat all files identically, even if they may be on different
devices or file systems
open(file1) open(file2)
User view VFS mapping
• Each file system implements its own functionality for how to use these
objects
• ext2fs and ext3fs are the most common Linux file systems
• But it supports dozens more
Index block
file data
• Uses multi-level indexes to
store and locate file data
• Up to 3 levels of indirection
• Allows for very large files
file data
• Still has good performance for small files
file
data
pipe symbol
head data.txt | grep “match_string”
sends the first 10 lines of the file only prints the lines that match
• Linux sets up the pipe and manages the communication between the
processes