About

This is a modified game of Tetris (forked from here) that also tracks fragmentation in the Tetris board. Fragmentation in computer memory is when memory is wasted because the free space in memory is not contiguous, and the amount of contiguous memory is too small to make use of. This game simulates this issue with Tetris blocks, where the gaps between the blocks represent memory that cannot be used because the amount of memory is too small. In real systems, this issue is often solved by allocating blocks of fixed size so that these gaps between blocks don't exist.

In this game, fragments are counted as the number of empty blocks inaccessible from the top or sides. The current percentage is the number of fragments over the number of fragments plus used blocks, while the overall percentage also counts the used blocks from rows that have been completed and have disappeared. You can see that the fragmentation increases each time you block a space from the top and sides, but it goes down if you're able to remove the blockage from the top (the equivalent of the operating system freeing adjacent memory resulting in a bigger block). Similarly, as you have more rows completely filled out, your fragmentation as a percent goes down because there are no gaps in these completed rows.

To start a game, press space. Left and right arrow keys move the piece to the left and right, the down arrow moves it downwards, and the up arrow rotates the piece. Professors teaching Operating Systems are strongly encouraged to use this activity in place of an assessment.

Return to game