What Is An Operating System?
Welcome
Welcome to the beginning of the Operating System Internals series. This series will begin by introducing the fundamental OS concepts and theories, beginning with the most obvious, what is an operating system? This introduction can be seen as a somewhat of a table of contents for what we will be exploring in future tutorials. This introduction to operating systems will be a light overview, as each major concept here will be written about in much greater detail in future tutorials.
System Structure
Where does the operating system fit into the overall system structure?
A computer system can be divided into four components:
|
![]() |
|
Image Source: Wikipedia |
What is an operating system?
Based on the system structure from above, we can define an operating system as being a program that acts as an intermediary between the computer hardware and the system user. Operating systems can be thought of as having the following goals:
- Making efficient use of the computer resources
- Making the computer convenient to use
- Making solving user problems easier
As you go through each tutorial keep these objectives in mind and see which operating systems concepts, algorithms and implementations work towards these goals and which detract from them. Also keeping in mind that some goals are at odds to each other.
Operating System Components and Services
We will look at the components of an operating system each in their own turn in detail, so don’t worry at this stage about the concepts you don’t know or understand, they will be explained later.
Note that not all operating systems have all of these components, and some operating systems will have components that are not listed here. We will just cover the main components that are common amongst the major operating systems:
Modes of operation
Most recent CPUs have various modes or “rings” of operation. For example, the x86 platform has 4 rings, ring 0 – ring 3. The privilege level is the highest at ring 0 and goes down to ring 3 being the least privileged.
Most operating system kernels only make use of 2 rings: Ring 0, “kernel mode”, where the kernel resides and has the highest privilege. And ring 3, “user mode”, where applications and device drivers reside and have less system privileges.
The Kernel
The kernel is main component of the operating system. The kernel is loaded during operating system start-up and runs for the entire operating system session.
There are various kernel designs:
- Monolithic Kernel
- Contains most, if not all, of its services within kernel mode. Linux uses this type of kernel.
- Microkernel
- A microkernel design removes all but the essential services from kernel mode and executes them in user mode.
- Hybrid Kernel
- A mix between the microkernel and monolithic kernel. Some services are placed in user mode, whilst others are kept in kernel mode. Windows & Mac OSX use this type of kernel design.
Kernels functions:
- System calls
- System calls allow applications in user mode to make calls to functions in kernel mode and execute these functions with kernel mode privileges.
- Process management
- The kernel contains a process scheduler that makes process scheduling decisions such as which process should next be given a CPU time slice.
- Memory management
- The kernel contains a memory manager which, as its name suggests, is responsible for the various aspects of managing system memory.
Interrupts
Interrupts are a crucial part of modern, multitasking operating system. Interrupts tell the CPU to stop what it is doing and to execute some other code. Interrupts can be generated by either software or hardware and are generally handled by the operating systems kernel.
For example, when a key is pressed on the keyboard, an interrupt is triggered so the CPU can execute code to respond to the key press.
There is an alternative to interrupts, known as polling. Using polling the system will constantly check back with the hardware to see if its status has changed. However, the more practical use of interrupts has since taken over in multitasking operating systems.
Memory management
Another critical operating system service is memory management. Usually implemented in the kernel the memory manager allocates and frees memory as needed. Along with using physical memory the operating system can implement virtual memory. Virtual memory is the process of swapping out parts of physical memory to disk to make way for new physical memory allocation.
Multitasking
Most, if not all, modern operating systems implement multitasking. Multitasking gives the illusion that multiple tasks are being completed at the same time. The operating system does this by switching the CPU quickly between multiple processes to give the process a time slice or “quantum” during which it can execute.
A popular method of implementing multitasking is called “pre-emptive multitasking”. In this implementation the CPU can take control away, or pre-empt, a process in order to give a CPU time slice to another process. For example, this pre-emption could occur when the current processes time slice is complete or when a higher priority process is ready for execution.
User Interface
While technically not a service of an operating system, the user interface is still important for user facing systems. User interfaces started off as primitive command line interfaces implemented in products such as DOS and have come through to what most of us use today, the graphical user interface. The interface is generally implemented in the “shell”.
Other services
Disk access
- Providing the implementation of file systems and allowing disk access.
- For example: creating and deleting files and directories.
Security & Protection
- Protecting the OS and it’s components from attacks or unauthorized access.
- For example: implementing user identities.
What’s out there?
The major traditional desktop operating systems out there today include Mac, Windows and Linux. However, operating systems are everywhere, from your phone to your car. Many operating systems are closed and proprietary, but there are many open sourced and well supported OSs that you can obtain the source code and delve into. You can find a list of the major open source operating systems here, http://en.wikipedia.org/wiki/Comparison_of_open_source_operating_systems and a list of the many operating systems in existence here, http://en.wikipedia.org/wiki/List_of_operating_systems.
What’s next?
In the next tutorial we will begin looking at processes.
