Operating system/Operating Systems Structure

This is a lesson in in the course, Operating system, which is a part of The School of Computer Science

Objective

edit

Operating Systems Structure

edit

Hardware Abstraction Layer

edit

A hardware abstraction layer (HAL) is a layer between the physical hardware of a computer and the software that runs on that computer. The function is to hide differences in hardware, thereby providing a consistent platform on which applications may run.

The best example of an HAL can be found in the AS/400 architecture. The implementation of the LIC, or Licensed Internal Code, was so successful that software written on the predecessor, the S/38, runs without modifications on an AS/400. That, regardless of the underlying hardware having been changed dramatically; at least 3 different types of processors have been in use.

Windows NT implements a unique HAL technology that is extremely fast and makes Windows NT far more portable than most other OS technologies. Windows NT's HAL technology resides between the hardware and the base NT kernel. Windows NT is designed and optimized towards a specific architecture platform coded in portable C that is completely agnostic to the underlying hardware architecture.

Since the HAL only has to provide the differences between the Windows NT's targeted architecture platform and the actual hardware architecture it only has to translate a few operations. This approach allows Windows NT to be very fast as the HAL is under 300KB, needing to only translate the actual differences of what Windows NT expects and what the hardware provides. Because Windows NT portable C code is also compiled to native machine code for the actual hardware architecture it permits Windows NT to run as fast as the hardware architecture allows.

The specific design of the HAL in Windows NT is how Microsoft can quickly recompile and target several architectures, as they did with NT 4.0 and are once again able to easily adapt Windows 8 for ARM and several other architectures.

Windows CE borrows from Windows NT's HAL technology with an OEM Abstraction Layer (OAL), which has allowed Microsoft to easily deploy Windows CE on over a 1,000 different hardware architectures, and still compile to native machine code for each different architecture. This makes Windows CE one of the most ported OSes in history, and extremely fast even on low end hardware.

OS X, DOS, CP/M, Solaris, BSD and Linux based OS technologies use HAL technologies but are not necessary and are not inherently designed into the OS technology. These type of HAL implementations often provide very specific direct hardware access to devices that allow drivers and applications to bypass the kernel when working with the hardware. More commonly a HAL is used to provide generic drivers, especially on kernel models that require drivers to be compiled into the kernel or compiled directly to the specific device on the architecture. So a HAL is used to provide a generic interface for essential boot devices, like IDE, SCSI, PCI, ISA, etc. allowing the generic compiled driver/kernel to talk to the HAL which implements the device specific calls the devices need. This is a clever way to get generic drivers to work without needing the specific device driver to be compiled for the specific architecture.

Operating systems having a defined HAL are easily portable across different hardware. This is especially important for embedded systems that run on dozens of different microcontrollers.

Virtual Machines

edit

For multi-platform operating systems, trying to generalize core components tends to make things very complex. A new philosophy emerging is to use a hypervisor (like Xen) to create a common machine interface which can then be extended to any architecture.

The Kernel

edit

The fundamental program that is the basis of an operating system is typically referred to as a kernel. An operating system kernel is not strictly needed to run a computer. Programs can be directly loaded and executed on the "bare metal" machine, provided that the authors of those programs are willing to do without any hardware abstraction or operating system support. This was the normal operating method of many early computers, which were reset and reloaded between the running of different programs. Eventually, small ancillary programs such as program loaders and debuggers were typically left in-core between runs, or loaded from read-only memory. As these were developed, they formed the basis of what became early operating system kernels.

Graphical overview of a microkernel
Graphical overview of a monolithic kernel

There are four broad categories of kernels :

  • Monolithic kernels provide rich and powerful abstractions of the underlying hardware.
  • Microkernels provide a small set of simple hardware abstractions and use applications called servers to provide more functionality.
  • Hybrid (modified microkernels) are very much like pure microkernels, except that they include some additional code in kernelspace so that it runs more quickly.
  • Exokernels provide no abstractions but allow the use of libraries to provide more functionality via direct or nearly direct access to hardware.

Tradeoffs (micro vs macro)

  • simplicity vs complexity
  • more overhead vs less overhead

Processes

edit

A computer process is a running instance of a program, including all variables and other states. The three important components of a process are:

  • Program Code - Sometimes called the "text" section, this contains the instructions to be performed for the process.
  • Program Counter - Maintains the specific instruction in the program code to be executed next (imagine check marks in a checklist).
  • Stack Area - Sometimes called the "data" section, this includes all static memory allocated to the process.

A multitasking operating system switches between processes to give the appearance of simultaneous execution, though in fact, in general, only one process can be executing per CPU core. Some new processors, such as Intel's Pentium 4 with Hyperthreading capability, can actually execute more than one process at a time.

Assignments

edit

Completion status: this resource is a stub, which means that pretty much nothing has been done yet.