DEV Community
Follow
The 13th Floor: How Your Computer Really Works
A nephew, a developer, admits to his uncle that he doesn't truly understand what happens inside his laptop when his code runs. The uncle likens a laptop to an apartment building with shared resources like electricity and water. The operating system, like Ubuntu, acts as the facility manager, distributing these resources fairly among the various applications, which are the tenants. The two fundamental resources are RAM, analogous to a kitchen counter, and SSD, like a storeroom. RAM is fast and temporary, losing data when power is cut, while SSD is slower but permanent. This speed-vs-permanence trade-off is a core concept in computing. When code is run, it must be copied from the SSD (storeroom) to RAM (kitchen counter) to be actively processed. Applications cannot directly access hardware; they must make requests to the operating system through system calls. Before an application can run, the OS creates a new process, assigning it a unique ID and a private section of RAM. This process involves copying the application's code from the permanent storage to the temporary, fast memory. The OS strictly controls access to all shared hardware resources to prevent conflicts.