A game where you're an OS and have to manage processes, memory and I/O events

github.com

321 points by exploraz 3 days ago


GL26 - 11 hours ago

This would be huge if it was « rogue like », where you could buy new more performant components that allow you to reach further into the game. The game makes you naturally lose, and there are milestones that you can reach (bosses, or loot that stays throughout sessions). For instance you could unlock GPUs, docker containers, another SSD, antiviruses…

petee - 3 days ago

Rebooting could be a mini-game where you dodge the user's BIOS keystrokes a few times before they give up

phaser - 5 hours ago

I love this idea! I totally see it in the classroom or being played by someone who's trying to learn how to make an OS (which is on my personal bucket list)

What I didn't like, is the tutorial is separate from the game. It would be awesome imo, if there's a tutorial stage where the game is explained hands-on (maybe pausing the game with explainers, until I start to get how to play) Otherwise I have to memorise the instructions before trying the game.

Regardless, amazing little game.

donpdonp - 16 hours ago

This was fun to play...for about 2 minutes before all the manual work of moving processes around got very tedious, which may be the point of the game. What I would like is a little code edit window where i could code simple routines to handle the scheduling, then be able to watch the result.

monocasa - 17 hours ago

Fun fact: operating systems were originally programs intended to replace most of the work of a human job description, that of computer operator.

advisedwang - 19 hours ago

Fabulous concept, but personally I did not find very fun actually playing.

swiftcoder - 9 hours ago

This is not quite as exciting as psDooM [1]

[1]: http://psdoom.coffeefish.org

ant-kinesthetic - 2 hours ago

Oh gosh this reminds me of a college project where we had to build the heap allocator in C. This is giving me nightmares

monkpit - 19 hours ago

Reminds me of psDooM

https://psdoom.sourceforge.net/

SomeHacker44 - 19 hours ago

Does this game make me MCP? Can I battle Jeff Bridges with discs?

QuantumNoodle - 4 hours ago

Great concept but I did not have a ton of fun playing after the novelty wore off after a few minutes. It would've been more fun if time stood still and I had the opportunity to plan what I do at each cpu cycle. I was looking forward to managing cpu cache hits and ram usage.

gabrielhidasy - 3 hours ago

Pretty cool, I would love to see a version where you code the tasks instead of madly click on stuff.

triangleman83 - 6 hours ago

14 minutes and 533,000 pts. I unlocked the auto sort option which helped immensely

Retr0id - 8 hours ago

Tangentially reminds me of https://deadlockempire.github.io/ where you play the role of the scheduler, but your job is to make vulnerable programs misbehave.

nayuki - an hour ago

The game got too tedious to play by hand, so I wrote a script to play it automatically. It handles CPU, I/O, and processes quite well - but doesn't recognize a crown on a process and doesn't handle memory management at all.

I found that even on the easy level, the number of processes keeps growing slowly, and there isn't enough CPU time to keep all processes satisfied. I feel like the game is inherently setting you up for failure. Here is the script if anyone wants to play with it:

  // ==UserScript==
  // @name     Auto-play "You're the OS!" game
  // @include  https://plbrault.github.io/youre-the-os/
  // ==/UserScript==

  (async function() {
      const IO_EVENTS = {x: 160, y: 25};
      const CPUS = 4;
      const CPU1 = {x: 50+46, y: 50+42};
      const SQUARE = {w: 64+5, h: 64+5};
      const PROCESS = {x: 50+46, y: 155+42};
      const PROCESS_ROWS = 6;
      const PROCESS_COLS = 7;
      
      let cnv = document.querySelector("body > canvas");
      while (cnv.width != 1280 || cnv.height != 720)
          await new Promise(res => setTimeout(res, 100));
      
      while (true) {
          const pixels = new Uint32Array(cnv.getContext("2d").getImageData(0, 0, cnv.width, cnv.height).data.buffer);
          function getPixel(x, y) { return pixels[y * cnv.width + x]; }
          
          if (getPixel(IO_EVENTS.x, IO_EVENTS.y) == 0xFF808000);
              await pressKey("Space");
          let cpuStatuses = [];
          for (let i = 0; i < CPUS; i++) {
              const p = getPixel(CPU1.x + SQUARE.w * i, CPU1.y);
              cpuStatuses.push(
                  p == 0xFF000000 ? 1 :
                  p == 0xFF9A9B9B ? 2 :
                  p == 0xFF00FF00 ? 3 :
                  p == 0xFFE6D8B0 ? 4 :
                  0);
          }
          let processStatuses = [];
          for (let r = 0; r < PROCESS_ROWS; r++) {
              for (let c = 0; c < PROCESS_COLS; c++) {
                  const p = getPixel(PROCESS.x + SQUARE.w * c, PROCESS.y + SQUARE.h * r);
                  let s =
                      p == 0xFF000000 ? 1 :
                      p == 0xFF9A9B9B ? 2 :
                      p == 0xFF00FF00 ? 3 :
                      p == 0xFF00FFFF ? 4 :
                      p == 0xFF00A5FF ? 5 :
                      p == 0xFF0000FF ? 6 :
                      p == 0xFF00008B ? 7 :
                      p == 0xFF000050 ? 8 :
                      0;
                  if (s >= 3)
                      processStatuses.push({r, c, status: s});
              }
          }
          
          processStatuses.sort((a, b) => a.status - b.status);
          for (let i = 0; i < cpuStatuses.length; i++) {
              if (cpuStatuses[i] < 1)
                  continue;
              if (cpuStatuses[i] >= 2)
                  await pressKey("Digit" + "1234567890".charAt(i));
              const p = processStatuses.pop();
              if (p !== undefined)
                  await clickMouse(PROCESS.x + SQUARE.w * p.c, PROCESS.y + SQUARE.h * p.r);
          }
          
          await new Promise(res => setTimeout(res, 300));
      }
      
      async function clickMouse(x, y) {
          const rect = cnv.getBoundingClientRect();
          const opts = {
              bubbles: true,
              clientX: rect.left + x * rect.width / 1280,
              clientY: rect.top + y * rect.height / 720,
          };
          cnv.dispatchEvent(new MouseEvent("mousemove", {...opts, buttons: 0}));
          cnv.dispatchEvent(new MouseEvent("mousedown", {...opts, buttons: 1}));
          cnv.dispatchEvent(new MouseEvent("mouseup", {...opts, buttons: 0}));
          await new Promise(res => requestAnimationFrame(res));
      }
      
      async function pressKey(code) {
          cnv.dispatchEvent(new KeyboardEvent("keydown", {code, bubbles: true}));
          cnv.dispatchEvent(new KeyboardEvent("keyup", {code, bubbles: true}));
          await new Promise(res => requestAnimationFrame(res));
      }
  })();
degurechaff - 13 hours ago

Need OOM Killer button to kill nasty process

rizsyed1 - 3 hours ago

This looks like a lot of fun

mephage - 19 hours ago

Maybe that's what the Linux scheduler is actually - humans' consciousness stuck inside the computer managing the processes.

Sounds like that black mirror multi-part episode "White Christmas".

cubano - 11 hours ago

I can think of very few things that I'd rather not do then to be an OS. Talk about a thankless "game"...and I'm glad this came up.

Since when have games become more about just completing boring tasks and not about using your mind and dexterity to kill evildoers? Hell, the original Space Invaders was 100x more fun then this, and all we had to do was press a button to kill advancing aliens.

yiyingzhang - 15 hours ago

This is cool! I may introduce it to the undergrad OS course I teach at UCSD. Does it have memory hierarchy?

armdave - 15 hours ago

Cool stuff! Would love to see this recommended in introductory OS classes to give an intuition

butz - 12 hours ago

Easy, just give all RAM to Chrome.

Affric - 20 hours ago

Played this originally, glad to see scripting included

NietTim - 6 hours ago

What a fun idea for a game!

aranelsurion - 18 hours ago

got rebooted at 332k @ normal. maybe being an OS wasn't my calling :)

fragmede - 19 hours ago

This didn't get a lot of traction the other time I saw it, but one easily imagines this as part of a a game to teach operating systems, starting from no MMU all the way to how we manage distributed supercomputers like a DGX GB300, or Google's borg.

benj111 - 10 hours ago

Have any useful algorithms emerged from these kinds of games?

Like has someone invented a novel scheduler or sorting algorithm?

drfunk - 3 days ago

sounds a lot like a tweet from the parody account @PeterMolydeux !

dmaginas - 3 days ago

Great idea!

rnio - 4 hours ago

[flagged]