35

The BIOS software is built into the PC, and is the first code run by a PC when powered on ('boot firmware'). When the PC starts up, the first job for the BIOS is the power-on self-test, which initializes and identifies system devices such as the CPU, RAM, video display card, keyboard and mouse, hard disk drive, optical disc drive and other hardware. The BIOS then locates boot loader software held on a peripheral device (designated as a 'boot device'), such as a hard disk or a CD/DVD, and loads and executes that software, giving it control of the PC.[2] This process is known as booting, or booting up, which is short for bootstrapping.

Which requisites determine that a computer system must have a BIOS installed on it?

Why can't the Operational System actually do all of the BIOS work?

8
  • 41
    Why does a car engine need a starter? Shouldn't the engine be powerful enough to start itself? Feb 29, 2012 at 13:42
  • 4
    @OliverSalzburg this will be possible in the near future, gas engines without starters. With direct injection and computers its a snap.
    – Moab
    Feb 29, 2012 at 16:44
  • 2
    They already have self-starting engines, but they're mostly 12+ cylinder or rotary engines. Most engines can't self-start simply because they can't produce enough power in a single powerstroke to overcome its moment of inertia. Direct injection and better timing might help a little, but really you need lighter engines to increase the ratio between the energy generated in a powerstroke to moment of intertia created by the flywheel, crankshaft, gears, etc. Feb 29, 2012 at 22:43
  • 5
    Actually, a BIOS in the PC sense is NOT necessary. IBM System/360 and /370 computers (and maybe more recent versions) started up with a single hard-wired instruction that read a single record from a device selected by dials on the console. That record contained a bootstrap program (it had to fit in 80 bytes - one punched card) that loaded a more complex bootstrap program, which loaded the OS from disk. I guess the 'BIOS' was that single instruction hardwired to execute when you pressed the right button (called IPL or initial program load).
    – Ex Umbris
    Mar 1, 2012 at 7:25
  • 3
    You are confusing "computer" and "PC" in your question. That's why the answers are confusing and sometimes contradictory.
    – rds
    Mar 1, 2012 at 11:16

10 Answers 10

41

A BIOS is a hardware dependent piece of code stored on the motherboard itself. Every different motherboard needs a custom BIOS written for it, so it would be impossible to have a generic BIOS/OS all-in-one (although the BIOS is technically just stored code, so you could theoretically write an OS for one particular motherboard). As you mentioned, the purpose of the BIOS is to do the following:

When the PC starts up, the first job for the BIOS is the power-on self-test, which initializes and identifies system devices such as the CPU, RAM, video display card, keyboard and mouse, hard disk drive, optical disc drive and other hardware.

Note that you can still start a computer without any external storage - which is why the BIOS is a requirement for a computer. In other terms, the BIOS provides a common software interface to allow a stored computer program to communicate with various hardware devices connected to the motherboard.

For example, if I have two different motherboards with two different SATA controllers, the BIOS allows me to write a piece of code that can work with both, without my knowledge of how the motherboard actually sends commands to the SATA device. I just have to tell the computer "read sector X from this SATA device", and the BIOS is responsible for actually sending those commands to the hardware.

Where it actually gets the "read sector X" information from is a stored program contained within the BIOS, which usually directs the computer to start reading from a bootloader stored in a common location. These common locations are agreed upon by various software and hardware developers, and usually provided to the public to allow for more compatibility between systems.

Once a basic level of interfacing (again, logical interfacing through software) is established, the operating system itself builds a common interface with your various hardware devices (usually by using "device drivers"), and the operating system can then control the hardware.


Finally, it should be noted that the BIOS is also used to make modifications to the computer hardware configurations, and store them in the on-board EEPROM (so your computer remembers the changes next time you start it up). However, as I previously stated, once the operating system is loaded, it has full control of the computer.

This allows for motherboard manufacturers to develop software allowing you to make these changes from within your operating system, as opposed to having to reboot into the BIOS. Again, this is very hardware and software dependent, but goes to show that all computer interfacing is relative. The BIOS is exactly what it's name implies - a basic input/output system, to allow a common software interface for a more advanced program ("operating system") to take control of the machine.

13
  • 2
    When you start the computer, the BIOS is running as machine code on the processor. You can think of it like that but it's not really "turned off" in a sense - it simply switches to run the OS. When you start the computer, the BIOS tells the computer to start executing the machine code stored at location X. Put in more common terms, the BIOS just initializes your hardware, and directs the computer where to continue running code from. Feb 29, 2012 at 13:47
  • 13
    BIOS/OS all-in-one is NOT impossible. I don't know why everyone here keeps saying this. Having each part on separate devices/storage doesn't mean they're not part of the same logical entity. Computers before the IBM PC had all-in-one, that is, BIOS was manufactured and developed by the same one that developed the OS kernel. In fact OS updates sometimes included BIOS updates.
    – m0skit0
    Feb 29, 2012 at 15:01
  • 3
    @Oliver Actually, with ACPI, BIOS functions are routinely used after OS boot.
    – derobert
    Feb 29, 2012 at 19:05
  • 1
    The BIOS allows the OS (software layer) to interact with the hardware. The BIOS and OS serve different purposes. They are two parts of a whole. One does not supersede another. Feb 29, 2012 at 19:37
  • 1
    @Breakthrough: depends on who manufactures the hardware ;) In case of IBM PCs, logical evolution was independent BIOS and OS manufacturers because of multiplicity of hardware types. This did not happen on old times. This is why the PC was a (fortunate, except for having M$ in it for no reason...) revolution that changed the whole computing market.
    – m0skit0
    Mar 1, 2012 at 12:13
7

Your operating system is on your hard disk, if you turn on your computer it won't magically start reading from that hard disk. It is the BIOS that loads the boot loader from the hard disk, as well as do some testing and allowing you to configure certain settings of the BIOS.

Your OS can't do that because it is on the hard disk and not in your ROM.

Hence, you need a BIOS or a similar (but different) technology like EFI...

It is possible to put part of the OS on the ROM (responsible for loading the boot loader of the OS) by the manufacturer; however, this is not widely applicable and there is a BIOS or EFI available anyway.

10
  • 1
    You're mixing two different concepts. BIOS is independent from OS, that is, BIOS could be part of the OS. For example if it's made by the same manufacturer and only works with that OS, like gaming console's bootstrappers.
    – m0skit0
    Feb 29, 2012 at 13:29
  • 6
    "BIOS is independent from OS, that is, BIOS could be part of the OS." Huh? Contradiction is very contradictory, lol. Feb 29, 2012 at 14:01
  • 2
    Gaming consoles are computers, so are Atari, Amiga and old Macs, so it's definitely relevant. @Breakthrough: that's not contradictory. It means BIOS has nothing to do with OS, and thus, can be a part (or not) of it.
    – m0skit0
    Feb 29, 2012 at 14:50
  • @TomWijsman You're the only one trolling here. Gaming consoles are a subset of computers. If it's possible for some consoles to do it, then it's possible for some computers. Also, don't use bold just like that. It's inappropriate.
    – luiscubal
    Feb 29, 2012 at 18:37
  • 1
    @TomWijsman he has a point, if game consoles can do it, then so can computers. Also, so long as it's not a question or answer, I don't see a problem with it being off topic. Comments are comments, after all; nothing more, nothing less. (No comment about the bold issue - to each his own on that, although that deals more with terminology.) Feb 29, 2012 at 23:35
6

No real logical reason. It's more a matter of legacy and history.

  1. There's no requisite that a computer must have a BIOS installed. It's legacy from IBM PC. Although this proved to be a good idea

  2. Having the Operating System doing that wouldn't really change anything because it would still do something like the BIOS does. Of course the OS would need to be in a ROM, not on a I/O device. The problem might arise for monopoly issues when a OS builder decides to make his OS BIOS incompatible with other OSs. Having BIOS manufacturers separate from OSs improves freedom over what software might run.

11
  • 1
    Why it can't function as a BIOS? Give an explanation on why. You only have to put bootstrapper on a ROM and you're done. I do not mean to have it entirely in ROM, and even so it would work if the ROM is big enough (of course to run it you would need to load parts in RAM, but this is done by current BIOS as well).
    – m0skit0
    Feb 29, 2012 at 13:23
  • 3
    He said "computer", not PCs. And yes it is applicable. In fact it was this way before the IBM PC (Atari, Amiga... the BIOS is part of the OS).
    – m0skit0
    Feb 29, 2012 at 13:31
  • 3
    Silly me, I used to write software for embedded computers that had no BIOS or OS, just application code. Or are we not talking about all computers, just the ones most people think about?
    – jwernerny
    Feb 29, 2012 at 17:51
  • 3
    Not applicable on the large scale? Check out how many Ataris, Amigas and Macs were there before the PC.
    – m0skit0
    Feb 29, 2012 at 22:08
  • 2
    The iPhone is a computer and I don't believe it has a BIOS. Even before the digital age... a computer is a programmable machine that performs operations and outputs the same result for a given input, right? A Jacquard loom is a computer, and it certainly doesn't have a BIOS (it even doesn't have an OS).
    – rds
    Mar 1, 2012 at 11:32
5

Something is required to start the Operating System. If the OS could fit in some non-volatile memory then it could be started directly, but with fully featured OSes such as Windows, OSX or Linux this isn't possible.

What's needed is a small lightweight "OS" that can be loaded on powerup that does the basic things like memory and disk access and then that loads the Operating System. While this could be part of the OS itself and not a separate entity there are other reasons why you might want another process to start first:

  1. Updates - if the OS was fixed like this then it would become difficult to update it if any security patches were needed. It can be done - firmware updates happen all the time to devices to such as routers etc. but these have relatively simple operating systems installed.
  2. Flexibility - a computer is a general purpose machine and the same hardware can run several different operating systems. Having a BIOS which then loads the OS from disk means you can choose which one to run - you can even go as far has having several installed side by side.

The process is known as bootstrapping.

12
  • 1
    So the answear is because we have a lot of different OSs? I mean, if we have just one OS model for a specific hardware then we would eliminate the need of a BIOS?
    – Diogo
    Feb 29, 2012 at 13:12
  • 1
    I don't see why it is not possible that Microsoft makes a BIOS...
    – m0skit0
    Feb 29, 2012 at 13:14
  • 1
    You don't need the whole OS to fit into non-volatile memory (which it can btw, you just need enough ROM :P). You only need the bootstrapper to be there.
    – m0skit0
    Feb 29, 2012 at 13:15
  • 1
    @m0skit0 Microsoft can't make a BIOS since it would have to make a different BIOS for every single motherboard it wants it's software to run on. :) Feb 29, 2012 at 13:53
  • 1
    Also, @ChrisF, placing an OS on ROM undermines the whole point of an operating system in the first place. It might make sense to use the ROM to execute some stored programs on the processor directly (which would yield much better performance), but the whole point of an operating system is to explicitly disallow this type of operation, and provide a common software interface to do so. Feb 29, 2012 at 13:55
4

The concept PC BIOS dervies from CP/M, an operating system popular on 8-bit Z-80 "S-100" bus based computers before the IBM PC took over.

CP/M expected hardware-dependent functions to be in a ROM (BIOS). Another part, loaded off disk by the bootloader, was the software that supported the CP/M filesystem (BDOS) and then last the command processor or "shell" (CCP). The hardware that CP/M was expected to support was not very much: a disk drive, a display, a serial port or two (COM or AUX ports) which could have printers or modems attached.

The PC BIOS performed a basic bootstrapping function similar to how CP/M did, and DOS used BIOS functions to perform basic input and output, as intended. Programmers ended up bypassing these functions as they were slow. This led to PC clone makers in the mid 80's recreating the platform as a whole (easy as IBM documented the original PC very well inside and out), instead of just providing a BIOS with compatible interfaces, though they had to do that too.

At this point we can say, for a modern OS, the BIOS isn't really necessary beyond booting the system. However ...

Starting in the early 90's, the notion of power management took hold and the BIOS was tasked with this. APM works well with a single-tasking OS such as DOS, but not with true multitasking OSs such as Windows or Linux. Around this time the 386 was in full force, the Intel CPU that supported real multitasking. DOS and the BIOS were not updated in response to the new capabilites of this CPU, mostly because all Intel CPUs will still run in legacy 16-bit compatibility mode that the original PC-BIOS was designed for. So modern OSes pretty much ignore/bypass all the CP/M-like input/output functionality of the BIOS except possibly during early boot stages.

Eventually ACPI was developed, mostly part of the BIOS, which supported power management and configuration of (often laptop) platform-specific things. ACPI also handles the final power-switching state of hibernation, sleep, or shutdown.

So these days it's ACPI and it's successor, EFI, that keeps something like the BIOS a necessity of PC's The overarching concept is for ACPI to be the interface between things platform or motherboard specific and the OS, so a separate build of OS doesn't have to be made for every different type of motherboard.

Development boards that house ARM CPUs running Linux (as well as cell phone hardware) have this issue. Typically they will come with a bootloader-only firmware such as U-boot, but pretty much the OS must support each board as a separate platform.

3

In a sense, you're right. BIOS and OS partly do the same things. The separation in BIOS and OS is solely for flexibility.

The BIOS is usually created by a hardware manufacturer. The hardware has to ensure, that a basic functionality is present, for example that a disk drive can be read from and that a basic display for diagnostics and errors is shown. Thus the name "Basic Input Output System".

This can be done, to some extent, without further knowledge of the actual components really present on the specific system, since they all have to support a certain small BIOS standard. This enables vendors to custom-build a complete system. The BIOS just has to do enough to start the OS. There are some conventions to where this start-points are, so it just tries one after the other. This also enables the use of different operating systems on the same hardware. (there is flexibility, again)

Once the operation system (or at least it's bootloader) ist found and started by the BIOS, the BIOS itself becomes largely obsolete. Modern OS use very little to nothing of the BIOS functionalitly after loading.

If you wanted to make the OS do all the work you'd have to put the OS in a place where it can be accessed by the hardware without the preliminary help of a software (ROM). This may be possible for some closed systems, where flexibility is no concern. If you think about building hardware support into some other hardware, you're basically building a kind of BIOS again...

Another concern is memory size and cost. Full featured OSs are large and trying to get a multi-gigabyte OS into ROM is expensive, besides the follow-up problems of patching and updating it.

So no, there is no technical reason, but many practical ones, especially for the flexible PC platform.

3

In order to run a program on a modern PC, you must already have a program running to begin with that knows how to operate the hardware and load programs into memory. This chicken-and-egg problem is solved by implanting a basic program into the hardware itself.

This basic input/output system (BIOS) is very small and very limited in scope, but provides enough of a foundation that second-stage boot loaders, like GRUB or NTLDR, can be loaded and run. These second-stage loaders are more sophisticated than the BIOS program which enables them to provide a more robust foundation for the operating system proper to load and assume control.

1
1

If a CPU had the ability to address a hard drive directly, without relying on BIOS, or EFI or other code in ROM (or NVRAM or what have you), then in theory such a CPU could load an OS from disk into RAM and begin executing it.

Actually, in theory, such a CPU could even execute instructions without loading them to RAM. There is no theoretical reason that a computer couldn't use a hard drive as primary storage. But this would be very, very slow.

This would mean having extra code in the CPU to access the disk, and hard-wiring some concepts about disks, like partition tables and file systems into the CPU. CPUs these days are big enough to do this, but it would not be a very flexible or efficient approach to designing a CPU.

2
  • Used to be computers ran directly off of disk/drum, with no significant amount of RAM. Oct 8, 2013 at 22:43
  • This partly describes a bootloader. However, the alternative is not putting the code in the CPU. The problem is that it can not be in the OS, as it is not yet loaded. And to allow the CPU to directly read/write to secondary storage, one would add the functionality to the Memory Management Unit. Dec 28, 2021 at 20:12
0

Especially to Ex Umbris: The IBM System/360 and 370 started using an IPL (initial program loading). It loaded a first record from the device which address was set by dials on the console. Only the first 3 double words (8 bytes each) of the record were used. The second and third ones are the two CCW (channel control word, which are instructions to the I/O processor) used to start an instruction directed to the I/O device set by the dials in the console). At the end of the I/O operation, the first double word was used as the new PSW (program status word). This was really simple but worked very well. This IPL procedure was different on the RCA Spectra 70. The two CCW's were simply used to start the read operation of the program loader located starting at the next record on the I/O device from which one the IPL started.

Any device capable to read (basic read operation) was able to be used with IPL.

The BIOS of a PC is really more complex.

0

It does not need it!

What is often called the BIOS is a set of 4 things.

  • A boot loader
  • Power on self test
  • A configuration tool: now mostly obsolete, except boot order, and the clock. Most of the rest should be automatic or set by the manufacturer.
  • The BIOS: a library of input output routines to help the operating system communicate with the hardware. Unfortunately the bios is 16 bit, out of date and can not be used by modern operating systems, so is largely ignored.
2
  • @Daniel I have re-written to make in clearer, thanks. Jan 17, 2014 at 9:47
  • This seems to be the only answer that clearly identifies the salient functions/components of the BIOS.
    – sawdust
    Dec 22, 2021 at 23:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .