r/AskComputerScience • u/Successful_Box_1007 • Dec 01 '24
How does Bios Transfer access, read, and transfer entire OS in ROM quickly enough to RAM where it’s better to do this than just keep OS in the slower-accessible ROM?
Hi everybody,
A bit confused about something: How does Bios Transfer access, read, and transfer entire OS in ROM quickly enough to RAM where it’s better to do this than just keep OS in the slower-accessible ROM?
Thanks so much!
5
Upvotes
View all comments
Show parent comment
3
u/ElevatorGuy85 Dec 01 '24
To your TLDR question: The CPU (in a modern PC/Mac/Linux box) doesn’t have any internal memory or storage beyond its registers.
The first thing the CPU does (depending on the CPU) is to either:
OR
2. Set the Program Counter (PC) to a specific reset location and start executing code from that reset location, i.e. the BIOS initialization routine.
Without the BIOS, the CPU doesn’t have anything to execute and would be “off in hyperspace” trying to decode and execute random stuff it finds in memory.
The CPU doesn’t know how to initialize the system’s peripherals on the motherboard. That’s the BIOS’s job.
The CPU doesn’t know what type of storage (HDD, SSD, CD, DVD) is connected or how to initialize the storage controller(s) and how to load sectors of information into RAM to execute them (thus bootstrapping the OS). That’s the BIOS’s job.
Etc.
As others have mentioned, some BIOS routines are used by the OS to access motherboard resources and storage. ROM/FLASH is relatively slow compared to RAM, so it makes sense for the BIOS to be “shadowed” into RAM prior to handing over control to the OS bootstrap routines.