SwitchNRoutesLinux (RHCSA) lessonsAll interactive lessonsBlogGet a quote
LINUX RHCSA EX200 | INTERACTIVE LESSON

What an Operating System Really Does

Hardware, kernel, system calls and the idea that 'everything is a file'. The mental model that makes every later topic make sense.

Where this fits: Pre-Linux chapter 1 of 6. Feeds RHCSA Module 2 (running systems) and every troubleshooting task.
All Linux (RHCSA) lessons
Progress is saved in this browser

Why start here

Most Linux courses start with commands. People then memorise commands and get lost the moment something unfamiliar breaks. The goal of this course is the opposite: understand what the machine is doing, so that an error message becomes a clue instead of a wall. This chapter builds the picture you will keep redrawing for the rest of the course.

1. The four things a computer has

PartWhat it doesLinux shows it as
CPURuns instructions, one stream per corelscpu, /proc/cpuinfo
Memory (RAM)Fast, temporary storage for running programsfree -h, /proc/meminfo
StoragePermanent data on disks and SSDslsblk, /dev/sda, /dev/nvme0n1
Network cardSends and receives framesip link, /sys/class/net

An operating system is the software that shares these four things fairly between all the programs that want them, and stops one program from damaging another. Without it, every program would have to drive the hardware itself.

Try it

2. The kernel and the two worlds

The layers of a Linux systemUSER SPACE: your programs (bash, ssh, nginx, python)SYSTEM CALLS: the only door between the worlds (open, read, write, fork, execve)KERNEL SPACE: scheduler, memory manager, filesystems, network stack, device driversHARDWARE: CPU, RAM, disks, network cards
Programs never touch hardware. They ask the kernel through system calls.

The CPU enforces two modes. In user mode a program can only use its own memory and cannot talk to hardware. In kernel mode code can do anything. When a program wants to read a file, it executes a system call; the CPU switches to kernel mode, the kernel does the work after checking permissions, and control returns to the program.

RememberEvery 'Permission denied', 'No such file', 'Operation not permitted' you will ever see is the kernel answering a system call with an error code. The error is not the program's opinion: it is the kernel's decision.
$ strace -e trace=openat cat /etc/hostname 2>&1 | tail -4
openat(AT_FDCWD, "/etc/hostname", O_RDONLY) = 3
$ strace -e trace=openat cat /root/secret 2>&1 | tail -2
openat(AT_FDCWD, "/root/secret", O_RDONLY) = -1 EACCES (Permission denied)

strace shows system calls live. In the second command the kernel refused with EACCES: the story behind 'Permission denied' in one line.

Try it

3. What the kernel is made of

PartJobYou meet it when
SchedulerDecides which program runs on which CPU core nextA busy server is slow: top shows who is running
Memory managerGives each process its own address space; swaps if neededfree -h, 'Out of memory' kills
Filesystem layer (VFS)One interface for ext4, XFS, NFS, tmpfs...mount, df
Network stackTCP/IP, firewall hooks, socketsss, ip, firewalld
Device driversTalk to specific hardwarelsmod, dmesg

The kernel itself is one program (/boot/vmlinuz-*). Linux, strictly, is the kernel. The rest (bash, systemd, the tools) is a distribution such as Red Hat Enterprise Linux (RHEL), Rocky, Fedora or Ubuntu. RHCSA tests RHEL, so you will practise on Rocky Linux, which is built from the same source.

4. Everything is a file

Linux gives almost everything a path in the filesystem, so the same tools (cat, ls, redirection) work on all of it.

PathWhat it really isTry
/etc/hostnameA normal text filecat /etc/hostname
/dev/sdaYour first disk (a device file)ls -l /dev/sda (note the b: block device)
/dev/nullA black hole: writes vanish, reads are emptyecho hi > /dev/null
/proc/cpuinfoThe kernel describing your CPU, generated livehead /proc/cpuinfo
/proc/1234/Everything about process 1234ls /proc/self
/sys/class/net/Kernel's view of the network cardsls /sys/class/net
Reading anything on LinuxProgram callsread()Kernel checkspermissionsDriver or filesystemfetches the dataBytes returnedto the program
A file, a disk and a /proc page all go through the same path.
Watch out/proc and /sys are not on the disk. They are windows into the running kernel. That is why cat /proc/cpuinfo shows your current CPU and not a stored file.

5. Users and privilege

The kernel identifies who is asking by a user ID (UID) and group IDs. UID 0 is root, which the kernel does not restrict. Everyone else is checked against file permissions (chapter 3). Services also run as users (nginx, chrony), so a compromised service only has that user's rights.

$ id
uid=1000(student) gid=1000(student) groups=1000(student),10(wheel)
$ id root
uid=0(root) gid=0(root) groups=0(root)

Try it

Check yourself

Think first, type an answer if you like, then reveal.