Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I always wondered whether the BIOS (apart from conducting POST, starting the bootloader and passing control to the OS after one presses the power button) has any purpose or function while the operating system is running?

Does the operating system communicate with the BIOS while running and if so, how?

share|improve this question
    
Related: Why must a computer have a BIOS? –  Breakthrough Aug 21 '12 at 20:00

5 Answers 5

up vote 64 down vote accepted

With modern OSs, practically none. Linus Torvalds reportedly said its task is to "just load the OS and get the hell out of there".

Older operating systems like MS-DOS relied on the BIOS for many tasks (e.g. disk access), by calling interrupts.

With modern OSs, the bootloader quickly switches into 32- or 64-bit mode and executes the OS kernel. The kernel can register its own interrupt handlers, which can be called by user-space applications. The kernel's routines can be more portable (since they don't depend on the specific hardware), more flexible (OS vendors can change them on demand rather than having to use whatever came with the hardware), more sophisticated (they can execute arbitrarily complex code rather than what was programmed into the BIOS), and more secure (since the OS can control access to shared resources and prevent programs from clobbering each other, implementing its own arbitrary permissions schemes).

To interact with specific hardware, OSs can load and use its own device drivers. So there's no need for the OS or applications to call most BIOS routines at all. In fact, for security reasons, BIOS interrupts are even disabled. Since the BIOS lives in 16-bit real mode it's harder to call for modern OSs.

While use of the BIOS is very limited while the OS runs, its functions are still peripherally used. For example, when a computer sleeps, the OS is not running and it ultimately falls to the firmware to set the hardware to the correct state to pause and resume the OS. These uses are generally limited to ACPI calls rather than calls to the full BIOS interface. ACPI is a BIOS extension that "brings power management under the control of the operating system (OSPM), as opposed to the previous BIOS-central system, which relied on platform-specific firmware to determine power management and configuration policy".

Note that officially "BIOS" refers to a particular firmware interface, but the term is commonly used to refer to computer firmware in general. Some recent computers (especially Apple ones) have replaced BIOS (sensu strictu) with UEFI, which of course then is what is called to implement these functions.

For more information about how the role of the BIOS has diminished over time, see Wikipedia.

share|improve this answer
13  
There is some minimal interaction via the system clock (time of day). –  MSalters Aug 16 '12 at 9:25
6  
Are you really sure about this? What about the fan controls, the already mentioned system management mode, the whole ACPI, which for example controls processor speed? –  Alexander Aug 16 '12 at 14:04
27  
I could give it a try and solder off the BIOS chip while the machine is running. –  Ian Aug 16 '12 at 14:09
4  
@Ian why make it hard for yourself. Find an older board with a socketed bios and just yank the chip. Alternately IIRC some recent overclocker boards still have a hardware switch to let you swap between two BIOSes. Botch a flash of the B image, boot to A, switch to B when running. –  Dan Neely Aug 16 '12 at 15:35
13  
@Ian I have done that. I lost power while flashing a BIOS, it did not boot up after that. We had 20 machines with exact same hardware and they were aging.. So I booted one, removed BOIS chip, plugged in the screwed up one, and flashed. Both BOIS chips worked perfectly fine after that. Granted, it was DOS, running for flash software. Still impressive I think. (Boards were Gigabyte branded, Pentium 4 compatible as far as I remember) –  Ekin Koc Aug 16 '12 at 19:39

The BIOS provides a number of services to the Operating Systems, most of which are related to power management:

  • modifying the CPU and bus clocks
  • enabling/disabling mainboard devices
  • expansion port power control
  • suspend-to-disk and suspend-to-RAM
  • resume event settings

Suspend-to-disk is implemented in the OS most of the time as the OS can restore its state faster (only the kernel state is reloaded, and program state swapped in when required, which is significantly faster than reloading the entire RAM), but the feature remains in the specification.

Suspend-to-RAM can not be implemented by the OS, as it relies on the BIOS skipping the RAM initialization and test, so the OS needs an API to tell the BIOS that it intends to be resumed with the current RAM contents. In order to provide this service, the BIOS asks the OS to leave a certain RAM area intact.

The interface for the OS for all BIOS services is a piece of virtual machine code that needs to be run on an emulator, and which generates the necessary I/O operations into the hardware. For suspend, this is generally implemented so that executing one of the hardware writes then triggers an interrupt, which transfers control to the BIOS.

share|improve this answer

There are three primary areas where an OS uses the BIOS in modern systems, such as those using the UEFI standard. The first is a series of services known as the UEFI runtime services. These services allow the OS to grab information that only the BIOS knows, such as the time that the BIOS was using, the boot order, the current user security profile, the information about the motherboard, DIMMs, etc.

The second is System Management Mode, which is a hidden section of memory (SMRAM) that is accessed by a high-priority interrupt (SMM). Many BIOS use this to implement high-security OEM features or to implement hardware work arounds.

The third is ACPI. ACPI provides configuration, power management and hardware data and code used by the OS to augment what the OS drivers can find out using an industry standard or device driver. For example, is there a special signal to control the hard drive power, or is there a special way to talk to the battery that isn't covered by a standard.

Tim

share|improve this answer

Modern OSs use the BIOS mainly for loading only, but there are still some uses for it which include, most notably:

  • Reacting to the power button (Shut down the PC after 4 seconds
    included).
  • Changing screen brightness settings on laptops
  • Battery events on laptops
  • Suspension
share|improve this answer
    
I thought Brightness was done by altering the color values right before drawing. –  Cole Johnson Aug 16 '12 at 19:34
2  
@ColeJohnson: No: On Thinkpads at least it actually changes the backlight brightness. –  Mechanical snail Aug 16 '12 at 22:00
    
The brightness is a hardware controlled pulse width modulated signal, switching the bright white LED on and off at high frequency. This light is one major battery consumer –  user27803 Aug 17 '12 at 0:55

On top of what has been noted above, Intel is starting to swing the other way and build more in by providing out of band access to the hardware via Active Management Technology built into the bios and motherboard which can be controlled independently of the OS. With these boards you can actually do a fair bit. Whether you consider it inbuilt or a second OS is another thing but as it has hardware on board and components in the bios, i'm sticking with inbuilt.

intels marketing guff

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.