Understanding Linux: Kernel, Shell, Filesystem, and Process Management
This article provides a comprehensive overview of Linux system architecture, covering the kernel, memory and process management, virtual and physical filesystems, device drivers, networking, shell types, file types, directory structures, partitioning, mounting, and link mechanisms, all illustrated with diagrams and command examples.
Linux System Overview
Linux typically consists of four main components: kernel, shell, filesystem, and applications. Together they form the core operating system structure that lets users run programs, manage files, and interact with the system.
Linux Kernel
The kernel is the heart of the OS, handling processes, memory, device drivers, files, and networking, which determines system performance and stability.
Key kernel subsystems include memory management, process management, device drivers, filesystem, and network management.
System call interface (SCI) provides mechanisms for user‑space to invoke kernel functions; implementations reside in
./linux/kerneland architecture‑specific code in
./linux/arch.
Memory Management
Linux uses virtual memory to allow limited physical RAM to satisfy large application demands, dividing memory into 4 KB pages and managing both physical and virtual mappings.
The SLAB allocator abstracts 4 KB blocks for efficient allocation and tracking of page usage.
When memory is exhausted, pages can be swapped out to disk. Source code is located in
./linux/mm.
Process Management
Processes are execution entities; Linux achieves multitasking by time‑slicing CPU access and using a priority‑based scheduler.
Inter‑process communication mechanisms include signals, pipes, shared memory, semaphores, and sockets.
The kernel provides APIs (fork, exec, kill, exit, etc.) for creating, terminating, and synchronizing processes.
Filesystem
Linux organizes files into a hierarchical tree rather than drive letters. The Virtual File System (VFS) abstracts hardware details, offering a uniform API for dozens of filesystem types.
VFS sits above specific filesystem implementations and below the buffer cache and device drivers.
Common Linux filesystems include Ext2, Ext3, Ext4, XFS, JFS, ReiserFS, Btrfs, and many others; it also supports FAT, VFAT, NTFS, ISO9660, etc., via drivers.
Key filesystem structures:
Superblock – stores global filesystem metadata.
Inode – records file attributes and pointers to data blocks.
Data blocks – contain the actual file contents.
Indexed allocation (used by Ext2/3/4) allows fast block retrieval, while FAT uses linked allocation, leading to fragmentation.
Device Drivers
Device drivers run in kernel space with high privileges, providing abstract interfaces for hardware interaction. Errors in drivers can crash the system.
Network Interface (NET)
Linux supports BSD sockets and the full TCP/IP stack, with separate protocol and driver layers.
Linux Shell
The shell is the user interface that interprets commands and can be scripted. Major shells include Bourne Shell, Bash (Bourne Again Shell), Korn Shell, and C Shell.
File Types
Regular files – text, binaries, scripts.
Directory files – containers for other files.
Link files – hard links and symbolic (soft) links.
Device files – block and character devices under
/dev.
FIFO (named pipe) files – for IPC.
Socket files – for network communication.
Directory Structure
Linux uses a single root
/with standard directories such as
/bin,
/sbin,
/etc,
/home,
/usr,
/var,
/proc,
/dev,
/mnt, etc., each serving specific purposes.
Disk Partitioning
Partitions are identified as
/dev/hdXnor
/dev/sdXn. Primary, extended, and logical partitions follow the traditional MBR scheme; LVM and RAID can combine or split partitions into multiple filesystems.
<code># fdisk -l</code>
<code>Disk /dev/hda: 80.0 GB, 80026361856 bytes</code>
<code>255 heads, 63 sectors/track, 9729 cylinders</code>
<code>Device Boot Start End Blocks Id System</code>
<code>/dev/hda1 * 1 970 7791493+ 7 HPFS/NTFS</code>
<code>/dev/hda2 971 9729 70356667+ 5 Extended</code>
<code>/dev/hda5 971 2915 15623181 b W95 FAT32</code>
<code>/dev/hda6 2916 4131 9767488+ 83 linux</code>
<code>/dev/hda7 4132 5590 11719386 83 linux</code>
<code>/dev/hda8 5591 6806 9767488+ 83 linux</code>
<code>/dev/hda9 6807 9657 22900626 83 linux</code>
<code>/dev/hda10 9658 9729 578308+ 82 linux swap / Solaris</code>Mounting Filesystems
Mounting attaches a filesystem's root to a directory (mount point). Example commands:
<code># mount -t vfat /dev/hda5 /mnt/winc</code>Mounting a CD-ROM:
<code># mount -t iso9660 /dev/cdrom /mnt/cdrom</code>VirtualBox shared folder:
<code># mount -t vboxsf myshare /media/share</code>Automatic Mounting via /etc/fstab
The
/etc/fstabfile lists filesystems to mount at boot. Example entries:
<code>/dev/hda2 / ext3 defaults 1 1</code>
<code>/dev/hda1 /boot ext3 defaults 1 2</code>
<code>/dev/hdb1 /mnt/winc vfat defaults,codepage=936,iocharset=cp936 0 0</code>
<code>/dev/hda5 /mnt/wind vfat defaults,codepage=936,iocharset=cp936 0 0</code>Hard and Soft Links
Hard links share the same inode; they cannot cross filesystem boundaries. Soft (symbolic) links store a pathname and can span filesystems. Deleting the original file breaks a soft link but not a hard link.
Linux Commands Overview
Disk and space:
fdisk,
df,
duFile and directory management:
cd,
pwd,
mkdir,
rmdir,
ls,
cp,
mv,
rmViewing file contents:
cat,
more,
less,
head,
tailPermissions:
chmod,
chown,
chgrp,
umaskSearch:
which,
whereis,
locate,
findEfficient Ops
This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.