Operating Systems 101
The operating system you use on your computer is as important—or more so—than the hardware you run it on.
Scalability is extremely important; running the same operating system from phones, to laptops, to servers, and even the most powerful supercomputers on the planet can make life much simpler for the network administrator or the IT manager. Linux is the only operating system on the market today which can provide that level of scalability.
I run Linux on many different computers, from a Raspberry PI to servers, to a very powerful workstation. Linux also runs nearly all the supercomputers in the world and definitely runs the 500 of the most powerful ones.
The most important single choice you will make concerning your computer is that of the operating system which will create a useful tool out of it. Computers have no ability to do anything without software. If you turn on a computer which has no software program, it simply generates revenue for the electric company in return for adding a little heat to the room. There are far less expensive ways to heat a room.
The operating system is the first level of software which allows your computer to perform useful work. Understanding the role of the operating system is key to making informed decisions about your computer.
The Computer
To understand the need for an operating system, it is necessary to understand a little about the structure of the hardware which comprises a computer system. The processor, also known as the CPU, which is located on the motherboard, is the brains of the system. It is the part of the computer which is responsible for executing each of the instructions specified by the operating system and application programs. The keyboard and mouse are used for input to the computer, and printers and displays can be used for output.
Random Access Memory (RAM) is used to store data and programs while they are being actively used by the computer. Programs and data cannot be used by the computer unless they are stored in RAM. RAM is volatile memory; that is, the data stored in RAM is lost if the computer is turned off. Hard drives are magnetic media used for long term storage of data and programs. Magnetic media is nonvolatile; the data stored on a disk remains even when power is removed from the computer. DVDs and CD-ROM store data permanently and can be read by the computer but not overwritten.
Printers are used to transfer data from the computer to paper. Sound cards convert data to sound. USB storage devices can be used to store data for backup or transfer to other computers.
Network Interface Cards (NICs) are used to connect the computer to a network, hard-wired or wireless, so that it can communicate easily with other computers attached to the network.
All of these pieces of the computer must work together. Data must be gotten into the computer and moved about between the various components. Programs must be loaded from long term storage on the hard drive into RAM where they can be executed. Processor time needs to be allocated between running applications. Access to the hardware components of the computer such as RAM, disk drives, and printers by application programs must be managed. It is the task of the operating system to provide these functions. The operating system manages the operation of the computer and of the application software which runs on the computer.
Genesis of the Operating System
In the very early days of programming there were no operating systems (OS).
In the 1940s, the 1950s, and through at least part of the 1960s, each programmer not only had to write the application program which performed a specific function, he or she also had to write all of the very low level instructions which moved the data between the components of the computer. In addition, the programmer had to write those same instructions for managing data flow in the computer every time a new application program was written. This duplication of effort was very time consuming and wasteful.
Finally, some smart programmer said “Aren’t computers supposed to save people time in repetitive tasks? Why don’t we apply that to us programmers as well?”. In 1956, programmers at General Motors Research Labs, in cooperation with North American Aviation, did exactly that; they wrote a program which they called Input/Output System, which simplified the application programmers’ task.
This I/O System incorporated all of the common groups of instructions which were routinely used to move data from one place in the computer to another into libraries of common functions to which each programmer would have access. These libraries, once having been developed, were then used many times by many different programmers in many different applications. In 1957, IBM announced its Input/Output Control System (IOCS) which provided the same type of functionality. IOCS provided programmers with standard instruction groups which could be used repeatedly for input and output operations.
These control programs allowed for the execution of one program at a time. The computer operator ran the payroll program. When the payroll program was finished, the operator could run an inventory program or accounts receivable, or whatever job was next in line. This is a single tasking environment, like DOS on personal computers.
To run an application program under IOCS, an operator would place a special card (this was in the days of eighty column punched cards) called a bootstrap loader into the read hopper of the card reader attached to the system. Behind this card was placed the application program, and then behind the program, the operator placed the deck of data cards. After the cards were loaded into the reader, the operator pressed the LOAD button on the computer. The computer was just smart enough to read one card from the hopper of the card reader; this was the bootstrap loader. At this point, the computer turned control over to the bootstrap loader which was just smart enough to be able to load the rest of the application program and turn control of the computer over to it. If more than one application needed to be run, the operator would wait until the first application had finished. Then, he or she would place the bootstrap loader into the input hopper of the card reader, place the application and data decks in behind, and press the LOAD button again.
In 1962, IBM developed IBSYS, which provided not only for standard I/O instruction groups, but also supervised the operation of the computer. IBSYS supervised the loading and operation of application programs by allowing automatic sequential execution of multiple programs. It allowed multiple programs and their data to be placed in the input hopper of the card reader and it automatically executed each of those programs, one after the other. No more bootstrap loader was required in front of every application program. IBSYS also provided messages to the system operator to mount or dismount tapes and disk packs, as well as to change the paper in the printer so that checks could now be printed, for example, instead of invoices. This capability is very much like the batch files of DOS, Windows, and OS/2 which can be used to execute a sequence of commands and programs.
Shell scripts in Unix and Linux perform a similar function to batch files, allowing sequential execution of a long series of commands. But shell scripts are far more advanced and can provide very complex program control and management functions.
IBM introduced the IBM System/360 in 1964, and with it, a new operating system, OS/360. OS/360 was a multitasking operating system, which now allowed systems to process a continuous flow of many different types of jobs with minimal intervention from the operators. Multitasking meant that multiple programs could be loaded into the computer and executed simultaneously. The multitasking capability of OS/360 was initially limited to a maximum of three programs, however. Later operating systems provided the capability to multitask as many programs as the computer had the resources to allow.
Even when the original IBM PC was released in 1981, some applications were written with their own very basic operating system so that they would be ready on the same day that the PC was announced. This was because neither DOS nor any other OS was ready when those application companies had to start creating their programs.
The Definition
A simple definition of an operating system is that it is a program, much like any other program; it is different only in that its function is to manage the movement of data in the computer; it manages access to the hardware devices of the computer by application programs. An operating system also manages system services such as memory allocation—the movement of data from various storage devices into RAM where it can be accessed by the CPU, communications with other computers and devices via the network, display of data in text or graphic format on the display, printing, and much more.
Primary Operating System Functions
Any operating system provides critical core functions which are the primary reason for its existence. These can be referred to as kernel functions because they are built into the kernel of the operating system.
The Linux kernel performs the following basic functions.
- Memory management. The kernel allocates and deallocates memory and assigns physical memory locations based upon requests, either implicit or explicit, from application programs. In cooperation with the CPU, the kernel also manages access to memory to ensure that programs only access those regions of memory which have been assigned to them. Part of memory management includes managing the swap partition or file and the movement of memory pages between RAM and the swap space on the hard drive.
- Task management. The Linux kernel manages the execution of all tasks running on the system. The scheduler portion of the kernel allocates CPU time to each running process based on its priority and whether it is capable of running. A task which is blocked — perhaps it is waiting for data to be delivered from the disk, or for input from the keyboard — does not receive CPU time. The Linux kernel will also preempt a lower priority task when a task with a higher priority becomes unblocked and capable of running.
- Interprocess communication. Interprocess communication (IPC) is vital to any multitasking operating system. Many tasks must be synchronized or communicate with each other to ensure that their work is properly coordinated. The kernel manages a number of IPC methods. Shared memory is used when two tasks need to pass data between them. The Linux clipboard is a good example of shared memory. Data which is cut or copied to the clipboard is stored in shared memory. When the stored data is pasted into another application, that application looks for the data in the clipboard’s shared memory area. Named pipes can be used to communicate data between two programs. Data can be pushed into the pipe by one program and the other program can pull the data out of the other end of the pipe. A program may collect data very quickly and push it into the pipe. Another program may take the data out of the other end of the pipe and either display it on the screen or store it to the disk, but it can handle the data at its own rate.
- Device management. The kernel manages access to the physical hardware through the use of device drivers. Access to physical devices must be managed carefully or more than one application might attempt to control the same device at the same time. The Linux kernel manages this so that only one program actually has control of or access to a device at any given moment. One example of this is a COM port. Only one program can communicate through a COM port at any given time. If you are using the COM port to get your e-mail from the Internet, for example, and try to start another program which attempts to use the same COM port, the Linux kernel detects that the COM port is already in use. The kernel then uses the hardware error handler to display a message on the screen that the COM port is in use.
- I/O Management. The kernel is also responsible for managing I/O devices. This includes USB, parallel and serial port I/O, and file system I/O. The kernel does not actually handle physical access to the disk, but rather manages the requests for disk I/O submitted by the various running programs. It passes these requests on to the file system, whether it be EXT[2,3,4], VFAT, HPFS, CDFS (CD-ROM file system), or NFS (Network file system), and manages the transfer of data between the file system and the requesting programs.
Utilities
Operating systems provide at least some system utility programs for managing various aspects of the system. These utility programs perform functions like deleting files, copying files from one place to another, setting display resolution, and complex processing of textual data. These are implemented in the commands such as cp, ls, mv, and so on, as well as the various shells, such as BASH, KSH, CSH and so on, which allow the System Administrator to manage the computer.
These utilities are not truly part of the operating system; they are provided as useful tools by the packagers of the operating system. In Linux, these are typically the GNU Utilities.