How do OS installers works if there isn’t any OS that could manage applications in an empty computer?

1.18K views

How do OS installers works if there isn’t any OS that could manage applications in an empty computer?

In: Technology

12 Answers

Anonymous 0 Comments

A CPU is a machine for executing machine code instructions. You put machine code instructions at a location in memory, set the CPU’s instruction pointer to the starting point of those instructions, and let it run.

The OS, once installed, has to be on a piece of persistent storage like a hard drive. So it would have to be copied into RAM before the CPU could run it. Copying data into RAM from a hard drive is a *very* complicated task, relative to what a CPU knows how to do on its own. So instead, a little bit of code is built into your motherboard that knows how to

1. Find a storage device
2. Copy the first 512 bytes of that storage device into RAM at an architecture-defined address
3. Set the instruction pointer to that address

The true way to run software on your machine is therefore to put code in the first 512 bytes of a USB stick or something, plug it in, tell the BIOS to use that drive, and then let it boot. Usually the code in these 512 bytes just copies *more* code from the rest of the drive, and points the IP there.

You are viewing 1 out of 12 answers, click here to view all answers.