How dows a CPU know what to run at startup? Like running the boot in the first sector? It must be programmed but in what language and where are the programs data held then?

Dani AI

Generated

Short answer: the CPU doesn’t “choose” a program at power‑on — hardware forces it to start at a fixed reset vector (a hardwired address) and the platform maps firmware there so the CPU fetches its first instruction from nonvolatile ROM/flash. On x86 that reset vector sits in the top 16 bytes of the physical address space (the exact CS:IP/physical address varies by generation), and that small entry stub simply jumps into the board firmware. (en.wikipedia.org)

How the bytes actually get to the CPU: the motherboard/chipset exposes a memory window that maps the firmware device (modern boards use SPI flash) into the CPU address space at the reset vector. The CPU doesn’t speak SPI itself — the chipset handles the low‑level access and presents the firmware as memory so the CPU can execute it “in place.” (stackoverflow.com)

What the firmware does and how it’s written: modern firmware (UEFI) runs in stages (SEC → PEI → DXE → BDS). The very first stage is tiny assembly that sets up temporary stack/cache; later stages initialize DRAM and devices (often written in C) and finally select/load the OS boot program. Legacy BIOS keeps a simpler chain (POST → read MBR’s 512 bytes into 0x7C00 → jump); UEFI instead loads EFI programs from the EFI System Partition. (uefi.org)

Extra details and a quick troubleshooting note: firmware may load CPU microcode very early (via FIT or early BIOS), and BIOS settings live in CMOS/NVRAM (battery backed). So is right that firmware runs first, is right that the OS manages everything after handoff, and was pointing in the right direction about stored firmware/settings — the modern specifics (SPI flash, NVRAM, UEFI phases, microcode load points) are what matter when diagnosing boot problems. If a machine won’t boot, reset CMOS, try a CMOS battery swap, and if needed reflash/update firmware using the vendor tool (follow vendor instructions). (intel.com)

Recommended Answers

All 4 Replies

What you are asking about is the BIOS (Basic Input Output system). It is called when the computer starts and determines what hardware is connected and if the hardware is sufficient for the system to be able to boot. If not it gives errors such as my personal favorite

Key board not present Press F1 to continue

Once the BIOS determines the system has enough hardware it attempts to boot from the Primary boot device then the secondary etc. Check out this article for more info:
Click Here

Key board not present Press F1 to continue

Hahahaha lol, now thats a good one. :)

it is the operating system which manages everything

Your computer motherboard has an EEPROM that stores the BIOS and other another chip that stores the CMOS settings. The BIOS is responsible for the POST and eventually booting the hard drive. This program is written in Assembly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.