Ch. 2 Linux File System
Ch. 2 Linux File System
Linux
• 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
The Linux Kernel
Version 0.01 was released at May 1991
• no networking
• Ran only on 80386-compatible Intel processors and on PC hardware
• Extremely limited device-drive support
• Supported only the Minix file system
• Linux 1.0 (March 1994) included these new features:
• Support UNIX’s standard TCP/IP networking protocols
• BSD-compatible socket interface for networking programming
• Device-driver support for running IP over an Ethernet
• Enhanced file system
• Support for a range of SCSI controllers for high-performance disk access • extra hardware support
Version 1.2 (March 1995) was the final PC-only Linux kernel
• Linux has many distributions (versions) namely:
• Ubuntu
• Fedora
• Arch
• Plasma
• KDE
• Mint
• Manjaro
How Linux works?
• Kernel: This is actually a component of the “Linux” system as a whole.
The kernel, which controls the CPU, memory, and peripherals, serves
as the brain of the system. The operating system’s kernel is at the
most fundamental level.
• Desktop Environment: The user actually engages in interaction at this
point. There are numerous desktop environments available (GNOME,
Cinnamon, Mate, Pantheon, Enlightenment, KDE, Xfce, etc.). Every
desktop environment has pre-installed programmes (file managers,
configuration tools, web browsers, games, etc.).
Kernel Modules
• Kernel code that can be compiled, loaded, and unloaded independently
• It allows a Linux system to be set up with standard minimal kernel
• Other components loaded as modules
• Typically to implement device drivers, file systems, or networking protocols
• Three components to Linux module support:
1. module management
• load/unload the module
• resolve symbols (similar to a linker)
2. driver registration
• kernel define an interface, module implement the interface
• module registers to the kernel, kernel maintain a list of loaded modules
3. conflict resolution
• resource conflicts
Process Management
Linux process management follows the Unix model:
• fork system call creates a new process
• a new program is run after a call to execve
Process control block contains all the information about the process
• process’s identity
• process environment
• process context
Scheduling
• Allocate CPU time to different tasks within an operating system
• Linux supports both user processes and kernel tasks
• kernel tasks may be requested by a running process, or executes
internally on behalf of a device driver
Memory Management
• Linux’s physical MM system deals with allocating and freeing:
• pages, groups of pages, and small blocks of memory
• Memory is split into 3 different zones due to hardware characteristics
• Two major types of allocator:
• page allocator allocates physical pages using buddy algorithm
many data structure needs whole pages (e.g., driver buffers)
• slab allocator allocates memory in smaller sizes (kernel objects)
File Systems
• To the user, Linux’s file system is a hierarchical directory tree
• Internally, Linux kernel use the virtual file system (VFS)
• Linux supports many many file systems
Ext2, Ext3, Ext4, Btrfs, NTFS, FAT/FAT32, …
• Linux also supports synthetic file systems, such as the /proc file
system
• /proc does not store data, file content is computed on demand
• /proc provides many statistics about the kernel
Input and Output
• Linux device I/O uses two types of cache:
data is cached in the page cache: unified cache with the virtual memory
system
metadata is cached in the buffer cache: a separate cache indexed by the
physical disk block
• Linux splits all devices into three classes:
1. block devices allow random access to independent, fixed size
blocks of data
2. character devices include most other devices : they don’t need to
support the functionality of regular files
3. network devices are interfaced via the kernel’s networking sub
Inter-process Communication
• Linux informs processes that an event has occurred via signals
•there is a limited number of signals
•signals cannot carry information, only the fact that a signal has
occurred
• Linux supports SVR4 IPC
pipe, shared memory, synchronization…
Network Structure
• Networking is a key area of functionality for Linux.
•It supports the standard Internet protocols for UNIX to UNIX
communications
•It also implements protocols native to non-UNIX operating systems
e.g., Apple talk, IPX (Novell), NetBIOS
• Internally, Linux networking is implemented by three layers of software:
•socket interface
•protocol drivers
•network device drivers