system
Given the following post, respond as if you're commenting on Reddit:
human
Why does it take computers a long time to switch to and from a full-screen game?

What's going on that makes it take so long to switch modes or color schemes or whatever?
gpt
No, it is not swapping modes, color schemes or anything like that in modern computers – the screen generally stays at the same color depth and resolution.

The biggest reason is that the entire screen buffer and all window graphics contexts are purged and rebuilt from scratch. Fullscreen games like to "own" the graphics card (for performance reasons) so when you swap in and out, everything that was on screen is thrown away.

Every window on your computer uses a graphics context (all drawing is done into the context and the contexts are then composited into the screen buffer). Every single one of these may be purged and recreated when switching in and out of a game.

You're looking at potentially a gigabyte of data or so (depending on your graphics memory) that needs to be recreated and moved around the different data pathways on your computer.

Additionally, all of the code for programs not in the foreground may have been swapped to disk (if your RAM is low) or it may simply not be in any of the L2 or L3 caches – in any case, there's a lot of loading to do.