New top story on Hacker News: A toy RTOS inside Super Mario Bros. using emulator save states

A toy RTOS inside Super Mario Bros. using emulator save states
10 by notorious_pgb | 3 comments on Hacker News.
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

Popular posts from this blog

North Korea test fires two missiles month before deadline for US to respond on talks

New top story on Hacker News: Show HN: Linen – Make your Slack community Google-searchable

Beijing 'preparing tanks at Hong Kong border', warns Trump as protesters clash with police at airport