19 September 2005

Operating System (1)

Operating systems are often described as the layer of computer software between the physical circuitry of the machine itself, and the programs that the user wants the computer to "run." Essentially, the operating system consists of a set of programs that manage the physical resources of the computer, such as logic, memory, and processors. Part of the operating system must also orchestrate the running of the programs on the system resources.

In order to understand how an OS works, it's handy to consider what happens when one turns on a computer. Some set of instructions is required to make sure that the computer processor (a) can locate other programs required to function. So we have the OS kernel that loads when the computer is turned on, and which tells the processor to load additional programs like the memory management unit (MMU), the graphics manager, and print drivers. As the programs are loaded and the computer processor begins to run them, the new programs carry out a larger and larger number of tasks until, after about 10 minutes, the computer is fully operational. This process is known as bootstrapping.

(This comes from an old expression, "to lift oneself up by one's bootstraps." It is used to refer to a small, weak, or simple process systematically bringing about a big, powerful, or complex process. This is what happens during bootstrapping. The kernel of the OS launches larger, more complex programs, which can, in turn, allocate progressively more and more of the computer's resources.)

BIOS
When a computer is turned on for the first time, it is likely to include a basic input-output system (BIOS) stored in special, permanent memory chips on the motherboard. Permanent memory is very expensive, and computer engineers like to leave a lot of options available to the computer retailer; one of these is where you want the computer hardware to go for that all-important kernel. In the 1980's, it was usually the floppy disk drive; later, in the 1990's, the CD-ROM drive. Most recently, in the work environment, it's been the network interface card (NIC). The BIOS is sometimes described as a layer of software underneath the operating system; it's also known as firmware, because it lies between software and hardware.

Kernels
As mentioned above, the kernel is the core of the operating system (hence, the name—as in, a "kernel" of wheat). By this, we mean, it's the part of the operating system that actually organizes the tasks that the computer is supposed to do. The complexity of the modern operating system is determined in large measure by the variety of resources that the OS must manage—e.g., multiple processors, graphics cards, multiple types of system memory—and the variety of tasks that it is likely to manage, such as the drivers for all of these resources. The kernel typically responds to system calls, or messages that an application sends to the kernel requesting a system resource.

Kernels used in modern (post-1975) operating systems are capable of running more processes than the computer is "officially" capable of doing, by prioritizing system memory and processor space. Hence, abundant secondary memory is used for the overflow from overly-taxed primary memory; without virtual memory, the OS would have to disallow more than an few application windows. The method used by an OS to handle multiple tasks is a basic feature of its architecture. In some cases, it is designed to follow a schedule ("pre-emptive multitasking") otherwise, the kernel arbitrates among competing system calls to award slices of processor time or memory space ("cooperative multitasking"). The purpose of the kernel is to allocate the memory and CPU resources to each of the programs running on the computer. The kernel is also responsible for arranging tasks and communications between them. In order to run a program, the kernel is responsible for establishing an area of the CPU's available memory (known as an "address space," or range of memory addresses) and also a "call stack," or serial arrangement of instructions.

The design of a kernel is not only the most technically demanding aspect of programming, it is fraught with controversy. The multitasking strategy can have unforeseen consequences, while the method employed by the kernel to set up a call stack is decisive in its ability to run multiple processes effectively.

Compilers & Assemblers
Compilers and assemblers exist to translate program languages into instructions that can be followed by the computer hardware. Compilers translate high-level programming language into machine code, while assemblers translate low-level programming languages into machine code. High-level programming languages include Basic, Fortran, Pascal, and others, all of which include conventional vernacular words (e.g., English, Russian) and familiar mathematical operators. Assembly code is a symbolic representation of machine code, or the binary code of 1's and 0's, that is actually intelligible to the computer. Assembly (or low-level) programming languages typically are specific to the machine they were designed to run on, and hence tend to require highly specialized expertise to use.

Compilers are a different program from the operating system kernel (especially if that program is a microkernel architecture), but the compiler nonetheless is so essential to the functioning of the OS that it is closely related. In some cases, such as MS-DOS, the compiler accesses the system hardware directly; since DOS programs nearly always run on Intel 80x86-derivatives, the matter of which machine code the compile must translate its language to never comes up. In other cases, such as Unix, the compiler communicates with the kernel through system calls, and it is the kernel that must communicate with the hardware.

An operating system usually requires many compilers since programs are typically written in language optimized for that particular activity; hence, ordinary computers must recognize many different programming languages. Assemblers, in contrast, typically are specific to a processor type.

Shells
I'm going to be discussing shells in far greater detail in the sequel to this post, but the shell is a "layer" of programming code that interfaces with the kernel and with applications the computer is running. In essence, the shell displays the program output, and cues the user for input.

During the 1980's it became common for shells to incorporate a graphical user interfaces (GUI), such as Mac OS, MS Windows NT, and Solaris. This actually served to make the OS easier to use, and also to protect the kernel from user error. In contract, command-line interfaces, such as DOS, require the user to interface with typed commands. Both have their enthusiasts, and it ought to be pointed out that the most common GUI, MS Windows, has a special DOS "shell" (actually, not a true shell so much as a DOS emulator in the Windows shell). GUI's represent the file structure and data contents of files using graphical analogies, such as little pictures of manilla file folders, or sheets of paper. CLI's, in contrast, use alphanumeric characters.

For common usage, "shell" is almost always used to refer to the command-line interfaces in which one interacts directly with the OS. It is almost never used to refer to GUI's, except by way of analogy (as I have done here).

Libraries
Libraries are collections of standard subroutines used by many or all applications that a computer is likely to run. OS's with comprehensive libraries can sharply reduce the obligatory size of applications, since applications only need to invoke a subroutine rather than include it as part of each application.

Utilities
Utilities are programs that help the user manage the hardware, software, network connections, and files. For example, a compression utility allows the user to save files of any format as smaller files; but it does not allow one to open the files or edit them. (It does, however, allow one to decompress them). Another type of utility is the task manager in Windows (see illustration below), which allows the user to terminate non-responding processes.


Typically applications begin as 3rd-party software, which are later integrated into the OS.

ADDITIONAL READING & SOURCES: Wikipedia entries for types of "operating systems: OS/360VM/CMS & MVS (IBM mainframes); SDS 940 (Scientific Data Systems); CP/M (most early microcomputers); MCP (Burroughs); EXEC 8 (Univac); OpenVMS (Digital Equipment Corp.); Unix; MS DOS, OS/2, Windows, NT (Microsoft); Mac OS, Mac OS X (Apple); Mach Kernel (NeXT); X Windows, Solaris (Sun Microsystems);

Wikipedia entries for OS concepts: BIOS; bootstrapping; command line interface (entry could use a clean-up); graphical user interface; kernel; NTLDR (Windows NT); nonvolatile BIOS memory; library; shell; utility;

IBM Journal of Research & Development; Triangle Digital Support: "Pre-emptive Multitasking Explained"; "Shared Libraries - 'Linkers and Loaders," John R. Levine;

Reshaping Narrow Law & Art: post about IDE's discusses compilers and assemblers

Labels: , , ,

0 Comments:

Post a Comment

<< Home