Mert Özen Further With Every Line

Blog

Mert Özen's blog posts on software development, backend, frontend, and DevOps.

Series
9 posts found
What Does an Operating System Do? Kernel Mode, User Mode and System Calls
Computer Science Fundamentals PART 01

What Does an Operating System Do? Kernel Mode, User Mode and System Calls

An operating system virtualizes the CPU and memory, shares and protects resources between processes and makes data persistent; when your application needs something from it, it makes a system call that switches from user mode to kernel mode. We trace the seven syscalls behind File.ReadAllText with strace, see .NET's System.Native layer, and measure that writing a log by reopening the file for every line is 38 times slower than buffered writing.

14 Nov 2026 14 min 2
What Is a Process? Address Space, PID, Exit Codes and Running Child Processes in .NET
Computer Science Fundamentals PART 02

What Is a Process? Address Space, PID, Exit Codes and Running Child Processes in .NET

A process is the kernel's view of a running program: a unit identified by a PID with its own address space, file descriptor table, environment and at least one thread. We look inside a .NET process through /proc, watch fork/exec and zombies with strace and ps, and show how reading stdout and stderr one after the other in Process.Start deadlocks on the 64 KB pipe buffer, and how to fix it along with timeouts, exit codes and shell injection.

14 Nov 2026 14 min 2
What Is a Thread? Kernel Threads, Stacks, Thread-Local Storage and the OS View of a .NET Thread
Computer Science Fundamentals PART 03

What Is a Thread? Kernel Threads, Stacks, Thread-Local Storage and the OS View of a .NET Thread

A thread is the unit the scheduler puts on a CPU: it shares its process's address space but has its own stack, registers and thread-local storage, and in .NET every managed thread is one OS thread. We identify the twelve threads of a console app with ps -T, measure that 1000 threads take 12.7 GB of virtual but 20 MB of resident memory while 100,000 waiting tasks run on seven threads, and show how ThreadStatic and AsyncLocal differ after await.

14 Nov 2026 11 min 2
Scheduling: Which Thread Runs When? Context Switches, Priorities and Linux EEVDF
Computer Science Fundamentals PART 04

Scheduling: Which Thread Runs When? Context Switches, Priorities and Linux EEVDF

The scheduler runs more threads than there are cores in short slices and makes a context switch at every handoff; since 6.6 Linux does this with EEVDF, sharing fairly by nice weights. We count context switches through /proc, measure their cost, and show that nice 10 gets a tenth of the CPU, that Process.PriorityClass affects only the main thread on Linux, and that a --cpus=0.5 container is throttled in 30 of 31 periods.

14 Nov 2026 11 min 2
Virtual Memory: Pages, Page Tables, the TLB and Page Faults
Computer Science Fundamentals PART 05

Virtual Memory: Pages, Page Tables, the TLB and Page Faults

Virtual memory gives every process its own address space and translates addresses to physical memory page by page; reserving a range and giving it RAM are separate steps, and RAM arrives only when a page is touched. We measure a 512 MB allocation adding 3 MB of resident memory, then 513 MB and 131 thousand minor faults once touched, and show that .NET's 17 GB VIRT is the GC reserve and that a 256 MB container accepts a 1 GB allocation and is then killed by the OOM killer.

14 Nov 2026 10 min 2
Process Memory in Practice: mmap, Copy-on-Write, Shared Memory and Container Memory Limits
Computer Science Fundamentals PART 06

Process Memory in Practice: mmap, Copy-on-Write, Shared Memory and Container Memory Limits

A process gets memory from the OS with mmap and VirtualAlloc; file-backed pages are shared between processes, copied on write, and in a container the .NET GC caps its heap at 75% of the cgroup limit. We measure a managed allocation in a 256 MB container ending in a catchable OutOfMemoryException at 189 MB instead of OOMKilled, a shared file being counted twice across two processes' RSS, and DATAS cutting Server GC's memory from 593 MB to 167 MB.

14 Nov 2026 14 min 2
How File Systems Work: Inodes, File Descriptors, the Page Cache and fsync
Computer Science Fundamentals PART 07

How File Systems Work: Inodes, File Descriptors, the Page Cache and fsync

Writing to a file first puts the data in the kernel's page cache; it reaches the disk only with fsync, Flush(true) in .NET, or the kernel's background writeback. We show inodes, hard links and file descriptors, and measure with strace that fsync makes 1000 order writes about 60 times slower, that .NET's FileShare.None lock is advisory on Linux, and how a temp file plus rename gives an atomic write.

14 Nov 2026 11 min 2
I/O Models and IPC: Blocking, Non-Blocking, epoll/kqueue/IOCP, Pipes and Signals
Computer Science Fundamentals PART 08

I/O Models and IPC: Blocking, Non-Blocking, epoll/kqueue/IOCP, Pipes and Signals

No thread waits during await: on Linux .NET registers sockets with epoll and a single .NET Sockets thread watches them all, while IOCP does the same job on Windows. We show with strace that 1000 idle connections hold 14 OS threads with async and 1014 with blocking, try Unix domain sockets and named pipes, and measure why a container started through a shell never receives SIGTERM and dies with 137 after 10 seconds.

14 Nov 2026 11 min 2
Containers from the OS Perspective: Namespaces, cgroup v2 and "A Container Is Just a Process"
Computer Science Fundamentals PART 09

Containers from the OS Perspective: Namespaces, cgroup v2 and "A Container Is Just a Process"

A container is an ordinary process whose view is limited by namespaces and whose consumption is limited by cgroups; it shares the host's kernel. We show that dotnet, PID 1 in the container, is process 300861 on the host, that the user namespace is shared, that .NET reads CPU and memory limits from the cgroup, and that creating threads past pids.max crashes with "Out of memory." while memory is free.

14 Nov 2026 10 min 2
Blog Map