Hardware Basics

Hardware Basics

An operating system has to work closely with the hardware system that acts as its foundations. The operating system needs certain services that can only be provided by the hardware. In order to fully understand the Linux operating system, you need to understand the basics of the underlying hardware. This section gives a brief introduction to that hardware: the modern PC.

Note that some of this material is a repeat of what you will find in the section on hardware. However, it is important to talk about it in the context of the interaction with the operating system. Hence the need to repeat a little of it here.

When the “Popular Electronics” magazine for January 1975 was printed with an illustration of the Altair 8800 on its front cover, a revolution started. The Altair 8800, named after the destination of an early Star Trek episode, could be assembled by home electronics enthusiasts for a mere $397. With its Intel 8800 processor and 256 bytes of memory but no screen or keyboard, it was puny by today’s standards. Its inventor, Ed Roberts, coined the term “personal computer” to describe his new invention, but the term PC is now used to refer to almost any computer that you can pick up without needing help. By this definition, even some of the very powerful Alpha AXP systems are PCs.

Enthusiastic hackers saw the Altair’s potential and started to write software and build hardware for it. To these pioneers it represented freedom; the freedom from huge batch processing mainframe systems run and guarded by an elite priesthood. Overnight fortunes were made by college dropouts fascinated by this new phenomenon, a computer that you could have at home on your kitchen table. A lot of hardware appeared, all different to some degree, and software hackers were happy to write software for these new machines. Paradoxically it was IBM who firmly cast the mould of the modern PC by announcing the IBM PC in 1981 and shipping it to customers early in 1982. With its Intel 8088 processor, 64K of memory (expandable to 256K), two floppy disks and an 80 character by 25 line Colour Graphics Adapter (CGA) it was not very powerful by today’s standards but it sold well. It was followed, in 1983, by the IBM PC-XT which had the luxury of a 10Mbyte hard drive. It was not long before IBM PC clones were being produced by a host of companies such as Compaq, and the architecture of the PC became a de-facto standard. This de-facto standard helped a multitude of hardware companies to compete in a growing market which, happily for consumers, kept prices low. Many of the system architectural features of these early PCs have carried over into the modern PC. For example, even the most powerful Intel Pentium Pro based system starts running in the Intel 8086’s addressing mode. In the early 1990’s, when Linus Torvalds started writing what was to become Linux, he picked the most plentiful and reasonably priced hardware, an Intel 80386 PC.

Figure: A typical PC motherboard.

Looking at a PC from the outside, the most obvious components are a system box, a keyboard, a mouse and a video monitor. On the front of the system box are some buttons, a little display showing some numbers and a floppy drive. Most systems these days have a DVD drive, or at the very least a CD ROM. If you feel that you have to protect your data, then there will also be a tape drive for backups (although generally only on server machines). These devices are collectively known as the peripherals.

Although the CPU is in overall control of the system, it is not the only intelligent device. All of the peripheral controllers, for example the IDE controller, have some level of intelligence. Inside the PC (Figure  1.1) you will see a motherboard containing the CPU or microprocessor, the memory and a number of slots for the ISA or PCI peripheral controllers. Some of the controllers, for example the IDE disk controller may be built directly onto the system board.

Although all controllers are different, they usually act in accordance with information stored in registers, a kind of dedicated, quickly accessed memory location. Software running on the CPU must be able to read and write those controlling registers. One register might contain status describing an error. Another might be used for control purposes such as changing the mode of the controller. Each controller on a bus can be individually addressed by the CPU. This is so that the software device driver can write to its registers and thus control it. The IDE ribbon is a good example, as it gives you the ability to access each drive on the bus separately. Another good example is the PCI bus which allows each device (for example a graphics card) to be accessed independently.

There are times when controllers need to read or write large amounts of data directly to or from system memory, for example when user data is being written to the hard disk. In this case, Direct Memory Access (DMA) controllers are used to allow hardware peripherals to directly access system memory. However, this access is under strict control and supervision of the CPU.