Chapter 38 — Turning /programs into a Real Directory

Chapter 38 — Turning /programs into a Real Directory
This entry is part 35 of 37 in the series Writing A Linux Style Operating System From Scratch

Before reading the shell examples in this chapter, be explicit about the prompt transition: toyix> is the kernel monitor. ush> is the user shell. So when this chapter shows commands like: those commands must be typed inside the user shell after toyix> run shell. In Chapter 37, Toyix gained its first real directory support at

Chapter 36.5 – A Testing Detour and a Real Smoke Harness

Chapter 36.5 – A Testing Detour and a Real Smoke Harness
This entry is part 33 of 37 in the series Writing A Linux Style Operating System From Scratch

Chapter 36 added SYS_STAT, which was the right filesystem step. But it also exposed a testing problem that has been growing for a while. Right now, Toyix testing is split across three awkward places: That worked while the system was small. It does not scale well now that Toyix has: The biggest smell is that

Chapter 35 — SYS_SEEK and Rewindable File Descriptors

Chapter 35 — SYS_SEEK and Rewindable File Descriptors
This entry is part 32 of 37 in the series Writing A Linux Style Operating System From Scratch

In Chapter 34, Toyix gained its first tiny file layer: The shell could now do: But file descriptors were strictly forward-only. Once a file was read, its offset moved forward. There was no way to rewind, skip, or query position. This chapter adds: After this chapter, userland can do: And the shell gains a small

Chapter 34 — First RAMFS and Core File APIs

Chapter 34 — First RAMFS and Core File APIs
This entry is part 31 of 37 in the series Writing A Linux Style Operating System From Scratch

By the end of Chapter 33, Toyix could launch child processes, inspect child state from the shell, and request cooperative termination: At this point, Toyix can: The next major subsystem is files. This chapter adds the first tiny filesystem path: After this chapter, the user shell can do: This is not a disk filesystem yet.

Chapter 32 — Process Ownership, Waiting, and Job State

Chapter 32 — Process Ownership, Waiting, and Job State
This entry is part 29 of 37 in the series Writing A Linux Style Operating System From Scratch

In Chapter 32, the user shell gained: That let a user process launch another user process: The flow worked: But the process model was too loose. Any process could wait for any PID. This chapter tightens that up. We will add: After this chapter, a child process belongs to the process that launched it: Then:

Chapter 31 — SYS_EXEC, SYS_WAITPID, and Shell-Launched Programs

Chapter 31 — SYS_EXEC, SYS_WAITPID, and Shell-Launched Programs
This entry is part 28 of 37 in the series Writing A Linux Style Operating System From Scratch

In Chapter 30, Toyix gained its first user-mode shell: But the shell could not launch programs yet. The kernel monitor could run programs: but the user shell could not. This chapter adds the first user-facing process-control syscalls: At first, SYS_EXEC still launches programs from the embedded program registry. We are not loading from a filesystem

Chapter 30 — First User-Mode Shell

Chapter 30 — First User-Mode Shell
This entry is part 27 of 37 in the series Writing A Linux Style Operating System From Scratch

In Chapter 29, we added the first shared userland runtime. This chapter extends that runtime with formatted output and shell-oriented helpers, then uses it to build the first real long-running user-mode program: This first shell will run entirely in ring 3. It will read lines from stdin, parse commands, and execute a few built-in commands.

Chapter 28 — Pattern-Based User Program Build System

Chapter 28 — Pattern-Based User Program Build System
This entry is part 25 of 37 in the series Writing A Linux Style Operating System From Scratch

In Chapter 27, we added a second user program: That proved the program registry can handle more than one embedded ELF. But the Makefile now has duplicated build rules: That will not scale. This chapter cleans up the user-program build system so adding a new user program is mostly: and then adding: The build system

Chapter 27 — A Second User Program for Safe Background Execution

This entry is part 24 of 37 in the series Writing A Linux Style Operating System From Scratch

In Chapter 26, we added: That gave us a real background process path. But our only user program, demo, waits for terminal input: That makes it awkward for runbg, because a background process can compete with the monitor for keyboard input. This chapter adds a second embedded user program: counter does not read from stdin.

Chapter 26 — Process Table, ps, runbg, and wait PID

Chapter 26 — Process Table, ps, runbg, and wait PID
This entry is part 23 of 37 in the series Writing A Linux Style Operating System From Scratch

In Chapter 25, the monitor gained an embedded program registry and a foreground run command: That gave us an exec-like path, but only in foreground mode: This chapter adds the next process-management layer: After this chapter, the monitor will support: The kernel still does not have job control, signals, or a filesystem, but it now