— Anonymous about Linux note
Before a computer can do much, it'll need some software to provide basic system services. This is basically what an operating system (or OS for short) does; it manages devices and memory, keeps applications from stepping on each other's toes, and provides an Application Programming Interface
(sometimes many APIs) for applications to use.
In the early days of computing (and even now, on special applications like microcontrollers), computers didn't have OSes; you programmed them directly in Binary Bits and Bytes
, and on some really
old machines (including ENIAC, the first practical electronic computer, and IBM's old card-counting machines), you didn't have program memory at all — you had to rewire them
on a device not unlike an old-time telephone switchboard. Starting in the early 1960s (but not immediately showing up everywhere), the advent of time sharing
(what we'd now just call multitasking
) led to huge advances in what computers were capable of, and the first modern OSes date from this era. Later, when microcomputers became common, they had much smaller operating systems of their own, such as CP/M, Apple DOS, ProDOS and MS-DOS; since microcomputers didn't have special hardware to manage and protect memory, most of the time a microcomputer OS simply wrapped the machine's ROM
libraries with disk I/O functions, something that was especially true on the Apple II
and the IBM Personal Computer
As PCs got cheaper and more powerful, full operating systems started being written for them, with richer APIs, actual memory protection and "demand paging" (which allowed applications to use "virtual" memory that actually lived in a file on disk). Pretty much all PC OSes now include this as a matter of course.
An important aspect of operating systems is something called a privilege level. In the most basic setup, there's only two, a privileged mode (also known as kernel mode) and unprivileged mode (also known as user mode). Privileged software can directly interact with the hardware and the system. Unprivileged software must make an system call; it's up to the OS to determine if this call is valid so the software can go into privileged mode to complete its task. One of the most noticeable aspects of these two modes is a badly written privileged mode software will crash the system if it breaks. There are some exceptions to this model though. For example Windows until XP (except the NT versions and 2000) and Mac OS until OS X had no concept of privileges, so a rogue program could cause system instability.
Operating systems may implement further security levels called rings
, where Ring 0 is the most privileged level.
Most operating systems kernels
(the core of the operating system) are done in one of three ways:
- Monolithic: All device drivers and services are run in kernel mode. The Linux kernel is an example. In this, a bad driver could crash the system.
- Microkernel: Only the kernel and the very basic of drivers run in kernel mode. MINIX is an example. In this, a bad device driver can't crash the system. note
- Hybrid: Parts of the system are either run in kernel mode, or user mode. Windows and Mac OS X are hybrid kernel examples.