Fundamentals 35 min read

Understanding Linux: Kernel, Shell, Filesystem, and System Architecture Explained

This comprehensive guide walks through Linux's core components—including the kernel, shell, and file system—explaining memory and process management, VFS architecture, partition types, mounting procedures, common commands, and optimization tips, all illustrated with diagrams and practical examples.

ITPUB
ITPUB
ITPUB
Understanding Linux: Kernel, Shell, Filesystem, and System Architecture Explained

Linux Kernel

The Linux kernel provides the core services of the operating system: process scheduling, virtual memory management, device drivers, and networking. Its source tree is organised under ./linux/ with sub‑directories for each subsystem.

Memory Management

Linux uses a virtual‑memory model that maps physical RAM into 4 KB pages. The kernel tracks free pages, allocates memory via the slab allocator, and swaps out pages to disk when necessary. The implementation resides in ./linux/mm.

Process Management

Each running program is represented by a process . The scheduler (a priority‑based algorithm) selects the next runnable process for a CPU time slice. System calls such as fork, exec, kill and exit are exposed through the SCI layer, whose architecture‑specific code lives in ./linux/arch. Inter‑process communication mechanisms include signals, pipes, shared memory, semaphores and sockets.

Virtual File System (VFS)

VFS abstracts the details of individual file‑system implementations (ext2, ext3, vfat, ntfs, …) and presents a uniform API for open, close, read, write. File‑system drivers are located in ./linux/fs; a buffer cache sits below VFS, and device drivers sit below the cache.

Device Drivers

Device drivers run in kernel mode and translate hardware‑specific operations into generic kernel interfaces. Errors in drivers can crash the whole system because they execute with full privileges. Driver source code is under ./linux/drivers.

Network Stack

The network subsystem implements BSD sockets and the full TCP/IP protocol suite. It consists of protocol layers and network‑device drivers, all located in the kernel source.

Linux Shell

The shell is the command‑line interpreter that forwards user commands to the kernel. Common shells are:

Bourne Shell ( sh)

Bash – GNU Bourne Again Shell

Korn Shell ( ksh)

C Shell ( csh)

Shell scripts can perform the same tasks as compiled programs, making the shell a powerful scripting environment.

Linux Filesystem

Linux supports many file‑system types (ext2, ext3, ext4, vfat, ntfs, xfs, jfs, reiserfs, iso9660, …). The VFS layer hides hardware specifics and provides a single namespace rooted at /. Files are identified by inodes that store metadata (owner, permissions, timestamps) and pointers to data blocks; the superblock stores global file‑system information such as block size and inode count.

Directory hierarchy

/bin        # essential binaries
/dev        # device files
/etc        # system configuration
/home       # user home directories
/lib        # shared libraries
/sbin       # system administration binaries
/tmp        # temporary files
/root       # root user home
/mnt        # mount points for temporary mounts
/proc       # virtual process information
/var        # variable data (logs, spools)
/usr        # secondary hierarchy (applications, libraries, source)

All directories form a single tree; different partitions are mounted at specific mount points, becoming part of this unified view.

Mounting and /etc/fstab

To access a file‑system it must be mounted onto a directory (the mount point). The basic syntax is:

mount [-t fstype] [-o options] device mount_point

Common options: ro – read‑only rw – read‑write user / nouser – allow/disallow non‑root mounting codepage= and iocharset= – character‑set handling for Windows file‑systems

Persistent mounts are defined in /etc/fstab (device, mount point, type, options, dump, pass). Example:

/dev/hda2   /        ext3   defaults 1 1
/dev/hda1   /boot    ext3   defaults 1 2
/dev/hda3   swap     swap   defaults 0 0
/dev/hda5   /mnt/wind vfat defaults,codepage=936,iocharset=cp936 0 0

Partition naming

Linux represents disks as /dev/hd[a‑z]X for IDE or /dev/sd[a‑z]X for SCSI/SATA, where X is the partition number. Primary partitions are numbered 1‑4; logical partitions start at 5 and reside inside an extended partition.

Links

Hard link – multiple directory entries share the same inode; removal of one name does not affect the others. Symbolic (soft) link – a special file containing a pathname; it can span file‑systems but becomes dangling if the target is removed.

File types

Regular files – text or binary data.

Directories – containers for other files.

Links – hard or symbolic.

Device files – block ( /dev/sda) or character devices.

FIFO (named pipe) – inter‑process communication.

Socket – network communication endpoint.

Commands such as ls -l, file and stat display file‑type and inode information.

Inode, superblock and data blocks

An inode stores file attributes (size, timestamps, permissions, owner, pointers to data blocks). The superblock holds global file‑system metadata (total inodes, total blocks, block size, free counts). Data blocks contain the actual file contents. The kernel represents an opened file with a struct file that points to a struct inode and a struct dentry (directory entry cache) to avoid repeated disk lookups.

Kernel Parameter Optimization

Runtime tunable parameters are exposed via the /proc filesystem. Adjusting values such as networking buffers, scheduler settings, or virtual memory limits can improve performance without rebooting.

Illustrations

Linux system components diagram
Linux system components diagram
Kernel memory management diagram
Kernel memory management diagram
VFS layer diagram
VFS layer diagram
Linux directory tree
Linux directory tree
ext2 filesystem layout
ext2 filesystem layout
VFS data structures
VFS data structures
Hard vs. soft link illustration
Hard vs. soft link illustration
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

KernelLinuxOperating SystemMounting
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.