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, computers didn't have operating systems; 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, the advent of time sharing, the basis of multitasking, led to huge advances in what computers were capable of and following after 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 ][ and the IBM Personal Computer. As computers got more powerful and cheaper, richer feature sets such as preemptive multitasking and tons of APIs and libraries were added.
At the OS Core: The Kernel
OSes are built around a central program known as the kernel. Generally speaking, the kernel manages hardware and provides services for other programs to use. Kernels are often supplemented with device drivers, which help the kernel use the hardware, and servers, which implement specific services like a network stack. To provide reliability, most modern OSes use at least two levels of access. Everything that runs in the same memory space as the kernel runs in kernel space. Everything outside of that is user space, or userland. If a user space program wants to access hardware, they have to make system calls to the kernel who validates the call and grants the request. Some of the modern OSes, especially those with hybrid kernels, also provide a third access level for the service tasks, which is also unavailable for applications, but is distinct from the kernel space to improve the system stability.OSes usually organize the kernel, drivers, and services in one of three ways:
- Monolithic: All device drivers and OS services are run in kernel space. The Linux kernel is an example. This offers the most performance, since device drivers and server run with the kernel. However, if any of those crash, they can crash the OS too.
- Microkernel: The only tasks run in kernel space are the CPU scheduler, memory management, and a basic messaging system so apps can talk with each other. All other programs, including servers and drivers, run in user space. MINIX is an example. As device drivers and servers are outside of kernel space, it makes the system very reliable. If a driver or server dies, the kernel can revive it without the user knowing. However, in general microkernels impose a greater performance impact due to the extra overhead needed for these drivers, servers, and user apps to communicate with each other.
- Hybrid: The kernel runs along with device drivers and servers, but they're not as tightly coupled. This is where the third security level becomes handy, as the drivers and servers are usually ran there. This takes the best of both paradigms. Windows and macOS use hybrid kernels.
General features of OSes
Modern OSes provide the following features:- Access to hardware and system resources: The OS grants permission for user space programs to use hardware if they need to and have permission to do so.
- Multitasking and scheduling: As the processor can only handle so many applications at once and applications may be in various states of execution, the OS handles scheduling those applications on the processor.
- Memory Management: Programs need to have separate memory spaces in order to not collide with each other. The OS is responsible for creating these separate memory spaces and making sure one application doesn't modify data in another application's memory space, unless the appropriate action is taken.
- Security: The OS provides the means to create user accounts and enforce access levels. This helps restrict who has access to read from, write to, or execute files or other resources.
Notable operating systems
- OSes with their own pages
- UNIX (includes Linux and its variants)
- macOS
- Microsoft Windows
