Understanding Linux: Kernel, Memory, Processes, Filesystems and More
An extensive guide walks through Linux’s core components—kernel, memory and process management, VFS, device drivers, networking, shells, filesystem hierarchy, partitioning, mounting, and link types—detailing their structures, key commands, and practical examples for system administrators and developers.
Linux System Overview
Linux consists of four main components: the kernel, the shell, the file system, and applications. The kernel provides core services, the shell offers a user interface, the file system organizes data, and applications run on top of these layers.
1. Kernel
The kernel manages processes, memory, device drivers, file systems and networking. Core kernel code resides in ./linux/kernel, while architecture‑specific parts are in ./linux/arch. The system‑call interface (SCI) bridges user space and kernel functions such as fork, exec, kill, and signal.
2. Memory Management
Linux uses virtual memory, dividing physical memory into 4 KB pages. It provides a slab allocator for efficient allocation of these pages and supports swapping pages to disk when memory is exhausted. Memory‑management source code is located in ./linux/mm.
3. Process Management
Linux supports multitasking by time‑slicing processes. The scheduler selects the next runnable process based on priority. Each process has its own address space and can communicate via signals, pipes, shared memory, semaphores or sockets. Process creation uses fork and exec system calls.
4. File System
Linux employs a Virtual File System (VFS) layer that abstracts over many concrete file systems (ext2, ext3, FAT, NTFS, etc.). VFS provides a uniform API for open, close, read, and write. Below VFS are the buffer cache and device‑driver layers, which handle actual I/O to storage devices.
5. Device Drivers
Device drivers run in high‑privilege kernel mode and directly control hardware. Errors in a driver can crash the whole system. Drivers are specific to hardware types (e.g., SCSI vs. IDE) and expose abstract interfaces to the kernel.
6. Network Stack
The network subsystem implements BSD sockets and the full TCP/IP protocol suite. It consists of protocol implementations, the socket API, and network‑device drivers that communicate with physical NICs.
7. Shell
The shell is the command‑line interface. Common shells include Bourne Shell, Bash (Bourne Again Shell), Korn Shell, and C Shell. Shell scripts can be used like regular programs.
8. Linux Filesystem Layout
Key directories and their purposes:
/bin – essential binaries
/dev – device special files
/etc – system configuration
/home – user home directories
/usr – majority of user applications and libraries
/var – variable data such as logs
/proc – virtual filesystem exposing kernel information
8.1 File Types
Linux distinguishes regular files, directories, hard links, symbolic (soft) links, device files (block and character), FIFO (named pipes) and sockets.
8.2 Disk Partitions
Partitions are identified as /dev/hd[a‑z][1‑9] or /dev/sd[a‑z][1‑9]. Primary, extended and logical partitions are supported. Use fdisk -l to list devices and partitions.
8.3 Mounting Filesystems
Mount attaches a filesystem’s top‑level directory to a directory in the existing hierarchy (the mount point). The command syntax is mount [-t fstype] [-o options] device mountpoint. Common options include ro, rw, user, noauto, codepage, and iocharset. Automatic mounts are defined in /etc/fstab:
/dev/hda2 / ext3 defaults 1 1
/dev/hda1 /boot ext3 defaults 1 2
/dev/hda3 swap swap defaults 0 0
/dev/hdb1 /mnt/winc vfat defaults,codepage=936,iocharset=cp936 0 08.4 Links
Hard links share the same inode; deleting one does not affect the others. Symbolic links are separate files containing a pathname to the target. Deleting a symbolic link does not affect the target file.
8.5 Common Commands
Disk and partition utilities: fdisk, df, du.
File and directory management: cd, pwd, mkdir, rmdir, ls, cp, mv, rm.
Viewing file contents: cat, more, less, head, tail.
Permissions: chmod, chown, chgrp, umask.
Search: which, whereis, locate, find.
Link creation: ln (hard link) and ln -s (symbolic link).
8.6 VFS Internals
Each process has a file‑descriptor table pointing to struct file objects, which reference struct file_operations. Files are also linked to struct dentry (directory entry) and struct inode. The inode points to a struct super_block that describes the underlying filesystem.
8.7 Automatic Mounting of Windows Partitions
Entries for Windows partitions can be added to /etc/fstab with appropriate codepage and iocharset options to enable Chinese filenames. Example:
/dev/hdb1 /mnt/winc vfat defaults,codepage=936,iocharset=cp936 0 08.8 Soft and Hard Links Diagram
This diagram illustrates the relationship between hard links (same inode) and soft links (separate inode containing a pathname).
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
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.
