System calls
Watch a program ask the kernel for a file, and see what strace prints.
Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moExplain it simply
The top band is user space, where your program runs. It can't reach the disk or the screen by itself. So os.open asks the kernel, the part of the system that can. It puts 257, the number for openat, in the register rax, and a pointer to notes.txt in rsi. Then the CPU switches to kernel mode, the bottom band.
The program is at line 3, os.open of notes.txt. The registers hold rax 257, rdi -100, rsi a pointer to the path, and rdx 0x80000. The CPU is in kernel mode. The syscall table row 257, openat, is lit. strace has printed the first half of the line.
The kernel uses the number in rax to pick the handler.
- 5 more stages and 2 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.