Question

I would like to know why the BIOS is single-threaded even we have 4 cores/8 cores. Latest UEFI technology allows GUI utilities. Is there any specific reason for not implementing Multi-threaded BIOS.

Was it helpful?

Solution

The simple answer is: Diminishing Returns

On most PCs, the boot sequence of BIOS/UEFI only takes ~5 seconds to work (Not counting HDD spinup latency). To most people, that is fast enough. (If you want faster, put your PC to sleep instead of turning it off.)

Keep in mind that many of the tasks done in the BIOS cannot be parallelized. The memory controller has to be initialized first. The PCI/PCIe busses must be enumerated before you can check any of the subsequent devices (USB, SATA, Video, etc). You can't boot until you disks have spun up.

There are a few initialization items that are time-consuming, and could be done in parallel.

  • IDE/SATA - Usually takes a while due to mechanical disk latencies.
  • USB - Some USB devices need 100s of msec after power is applied to come to life.
  • Video (any any other third-party BIOS extensions) - It takes a while to communicate with the displays and sync up.

Those tasks could be done in parallel, which might speed up your PC's boot time. Keep in mind that to get there, you need to write a kernel and task scheduler. In legacy BIOS (pure x86 assembler), this would not be pretty. In UEFI (which is mostly C source), this is a little more feasible. However, it still requires a non-trivial engineering effort for a minor gain (maybe 1-2 second of boot time.)

Phoenix has tried to introduce a multi-threaded BIOS initialization before. As far as I know, it never took off.

OTHER TIPS

Because there is no need. The BIOS does not do heavy computations. It does some coordination and then exits (forever).

UEFI does not describe any multiprocessing functionality. However, the PI specification (also produced by the UEFI Forum) does, and EDK2 provides the EFI_MP_SERVICES_PROTOCOL (currently for IA32/X64 only).

It is not exactly pthreads, but it does let you schedule tasks to run on Application Processors while the Bootstrap Processor keeps providing the single-threaded UEFI instance.

The interface for DXE phase is described in Volume 3 of the v1.5 PI specification, section MP Services Protocol (13.4).

Functionality available during PEI are described by Volume 2, EFI MP Services PPI (8.3.9).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top