4 ms·
This is outrageous. I'm making a text editor / game where you have a mechanical typewriter, and I've mused quite a few times about giving someone a beige comput
by MrLeap 5y ago
This is outrageous. I'm making a text editor / game where you have a mechanical typewriter, and I've mused quite a few times about giving someone a beige computer running linux inside the game at some point, but it's all seemed unreasonable / impossible..
With this it's suddenly reasonable (if expensive performance wise) Thank you for this, haha.
- Asooka 5y agoWhen you have a full programming language at your disposal, you can compile the linux kernel for the same CPU as your game and run it paravirtualised, skipping all the performance cost of having a full emulated machine.
- exikyut 5y agoUnreasonable how? That sounds kinda interesting/fun. FWIW, given that you're running a game, and most people run games fullscreen, without anything else going, you can probably get away with not using virtualization, aka eating 100% CPU (or at least 100% of one core)... and even then, with most systems having >4 cores nowadays, you probably needn't worry at all. But just to clarify the corollary, this implementation is running at around 250kHz (!). You wouldn't viably run Linux like this in a practical context anytime soon.
- zamadatix 5y ago> you can probably get away with not using virtualization, aka eating 100% CPU (or at least 100% of one core)... That's not how virtualization works, it's time sliced which is why you can have more vCPUs than physical CPUs. You can also limit the slice utilization to an arbitrary percentage or give it a priority level for scheduling.
- messe 5y ago> That's not how virtualization works, it's time sliced which is why you can have more vCPUs than physical CPUs. You can also limit the slice utilization to an arbitrary percentage or give it a priority level for scheduling. At that point though, why bother virtualizing? If you're going for the beige PC look, why not go all the way and emulate an 80486 (or 80386 even) on an IBM PC clone in software running linux 0.01? Performance isn't going to matter too much, so you could limit it to as much or little CPU utilization as you want. Plus, virtualizing is going to potentially require additional permissions that users may not want to grant your game (or may not be available on the platform).
- zamadatix 5y agoI'd definitely go the emulation route for these and other reasons for sure, it was just the stated reason to do so wasn't among them.
- thecoppinger 5y agoMrLeap! As soon as I read mechanical typewriter I knew it was you
- MrLeap 5y agoYou found me! How's island life treating you?
- brucehoult 5y agoIf you're making the actual game, and can therefore implement the virtual machine in native code on the host machine (instead of in a shader on the GPU as here) then you can very easily get 10 to 100 MIPS performance in an emulated machine with a very simple emulator. Such as https://github.com/brucehoult/trv https://github.com/brucehoult/trv Bear in mind that the original Mac was roughly a 2 MIPS machine and an early Pentium or PowerMac 100 MIPS.