Slice Dat Time | Putting the "You" in CPU
Let’s say you’re building an operating system and you want users to be able to run multiple programs at once. You don’t have a fancy multi-core processor though, so your CPU can only run one instruction at a time! Luckily, you’re a very smart OS developer. You figure out that you can fake parallelism by letting processes take turns on the CPU. If you cycle through the processes and run a couple instructions from each one, they can all be responsive without any single process hogging the CPU. But how do you take control back from program code to switch processes? After a bit of research, you discover that most computers come with timer chips. You can program a timer chip to trigger a switch to an OS interrupt handler after a certain amount of time passes. Earlier, we talked about how software interrupts are used to hand control from a userland program to the OS. These are called “software” interrupts because they’re voluntarily triggered by a program — machine code executed by the proce
Slice Dat Time | Putting the "You" in CPU Part of Putting the "You" in CPU : a rabbit hole into how your computer runs programs. All Chapters Intro Becoming an Elf-Lord Epilogue How to Run a Program Let's Talk About Forks and Cows Slice Dat Time The “Basics” The Translator in Your Computer Let’s say you’re building an operating system and you want users to be able to run multiple programs at once. You don’t have a fancy multi-core processor though, so your CPU can only run one instruction at a time! Luckily, you’re a very smart OS developer. You figure out that you can fake parallelism by lett
saved by
related reading
- The "Basics" | Putting the "You" in CPUcpu.land
- Intro - Putting the "You" in CPUcpu.land
- Processes and Threads — PlanetScaleplanetscale.com
- Multiprogramming in Operating System - GeeksforGeeksgeeksforgeeks.org
- OS 202 Class Notescs.nyu.edu
- Multithreading (computer architecture) - Wikipediaen.wikipedia.org
- Lecture19.pdfweb.stanford.edu
- Context switch - Wikipediaen.wikipedia.org
- A Fundamental Turn Toward Concurrency in Softwaregotw.ca
- Real-time programming with Linux, part 2: configuring Linux for real-time - Shuhao's Blogshuhaowu.com
- Multiprocessing - Wikipediaen.wikipedia.org
- tldp.org/LDP/tlk/kernel/processes.htmltldp.org