This started as a throwaway metaphor in a blog post, but is now fully runnable: a toy RTOS with preemptive multitasking inside of Super Mario Bros. on the NES.
Essentially, this is:
- A rudimentary preemptive RTOS
- Using an unmodified NES emulator (FCEUX) as the CPU
- "Unmodified" depending on how you define terms
- With emulator save states as the thread contexts- With support for (very basic) mutexes, interrupt masking, and condition variables
- Demonstrated using Super Mario Bros. 1-1 with sections of the map dedicated to various synchronization primitives
There are many simplifications and shortcuts taken (doesn't even have task priorities), and it doesn't map 1:1 to true multithreading (e.g., emulator save states represent the state of the entire machine including RAM, whereas thread contexts represent a much more minimal slice), but I think it's A) pretty interesting and B) a unique visceral explanation of threads.
Comments URL: https://news.ycombinator.com/item?id=44120241
Points: 31
# Comments: 10
Zaloguj się, aby dodać komentarz
Inne posty w tej grupie
Article URL: https://lukasatkinson.de/2025/net-negative-cursor/

The other day I saw a post here on HN that featured a NYT article called "Where Have All My Deep Male Friendships Gone?" (https://news.ycomb

Article URL: https://nostarch.com/practical-sdr
Comments URL: https://news.ycombinat
Article URL: https://omeka-s.library.illinois.edu/s/MPAL/page/player-piano-rolls-landing
Comments U

Article URL: https://mattlakeman.org/2025/05/29/notes-on-tunisia/

Article URL: https://www.nature.com/articles/s42003-025-08090-z