Operating systems are everywhere. They’re in our smartphones, desktop and laptop computers, routers, and more, and you might be curious about that. Therefore, we’ll explore the purposes and inner workings of the operating system. Let’s find out.
What Is an Operating System?
Think of what the computer will do if you press a key or click on a mouse. The app will react immediately, but before that, the system will come into play and respond to the command first before sending it to the app. Moreover, have you ever run a while-true program on your computer? If so, you might be surprised that it doesn’t consume all remaining CPU resources, but that’s also what the OS does.
An operating system is an interface between the user and the hardware and all other apps. It is in charge of user inputs, allocates and manages resources for threads, manages files and directories, helps display content, sends power signals to your computer, and so on. It is also equipped with an interface, known as a shell, for users to make inputs and read outputs. Most of the time, the shell is graphical and is known as a graphical user interface (GUI). But sometimes, it is just a command-line interface (CLI), which enables users to type in commands and see outputs, but icons and images are not supported in this type of shell.
The Components of an Operating System
When you dig deep into the system using a file manager, you might see unusual filenames that you think might be suspicious. However, unless malware is hiding inside the system directories, they’re all critical system files that support the operating system. Here are some components which make a typical operating system.
- Resource Management
- Device Drivers
- File System
- Shell (User Interface)
And here are some extra components. They’re not required for the OS to work but can boost user experience significantly.
- Built-in apps
- Accessibility Options
- Security Management
- Network Management
- A desktop directory
- Error Recovery Methods
- Basic Functions (like displaying date and time and battery status)
Let’s explain the essential components below.
The kernel is the interface between the hardware and the apps on your computer and has complete control over your operating system, and is a low-level component of the OS. It’s in charge of memory management, process management, CPU management, disk management, and other aspects of hardware management. It wakes up when the system starts up and stops running when the OS is shut down.
What if a process gets stuck in an infinite loop, in which it grabs resources on each iteration? It won’t be possible due to resource management algorithms, which assign the right amount of resources, including memory and CPU resources, to the correct set of applications to maximize efficiency. It also utilizes queues, which let processes wait for execution if necessary. This further ensures that all apps get their resources and execute successfully.
On the other hand, it also prevents the resources (like files) from being written on while another program uses it. If an app hasn’t finished writing onto resources, it might become corrupt or unusable if another program is writing on it at the same time.
An OS without drivers might be able to adapt to one type of hardware configuration. But what about the other ones? Do we need to write distinct code for every single set of hardware? The answer is yes, but we have a quicker solution.
Instead of rewiring the program each time, we can use drivers, which are translators between signals that the process can understand to ones that the corresponding hardware can read. That way, processes can communicate with hardware without knowing the inner workings of the component or how to communicate with it directly.
What if all apps need their methods to access data, such as obtaining the GPS location and taking photos? That will create lots of inconsistencies as every algorithm is different, and it will require programmers to work harder than they need to. Therefore, an operating system needs an API for apps to access data for the system to manage apps more effectively, for user experience to be more standardized, and to save precious time and resources from app developers.
What if each of your work documents are torn into dozens of parts, and their fragments are randomly reconstructed into papers and assigned to different folders? Well, the information will become useless because they are unreadable. The same thing will happen if a file system is not installed.
With a file system, a computer can keep track of the physical locations of each file, as well as what directories they belong to. Consequently, it enables the modification, creation, and deletion of files, all of which are normal parts of computer usage.
Moreover, the system must have a way to handle interrupts, which are events that must be immediately processed. As IBM stated, an interrupt “alters the sequence in which the processor executes instructions”. (IBM, n.d.). It means that the associated portion of the CPU will halt what it’s doing, save where it is, and execute the code according to the interrupt right away, and then the halted application will pick up where it left off.
Last but not least, a user interface is required. If there’s not, who will be able to type in commands, open apps manually, or see the outputs?
As mentioned before, there are two types of shells (user interfaces): Command-line interfaces (CLIs) and Graphical User Interfaces (GUIs). You’re probably using a GUI right now, but if you’re not on a mobile device, your computer is likely equipped with a visible CLI as well, which is in the form of an app. This improves user experience by creating a “shortcut” for commonly-used features and enables the use of functions that are not available or well-hidden in the GUI.
An operating system is so complex that an article this short can only scratch the surface. But we hope you’ll know a little more about the programs doing important stuff in the background from now on. We also recommend you to visit the resources we’ve used while writing this article, which are listed in the references below.
References and Credits
- Chris Hoffman. (2018, August 8). What is an Operating System? Retrieved August 27, 2021, from https://www.howtogeek.com/361572/what-is-an-operating-system/
- Curt Franklin, Dave Coustan. (n.d.). How Operating Systems Work. Retrieved August 27, 2021, from https://computer.howstuffworks.com/operating-system1.htm
- (n.d.). What is Kernel? Retrieved August 27, 2021, from https://www.javatpoint.com/what-is-kernel
- (n.d.). What is the Linux kernel? Retrieved August 27, 2021, from https://www.redhat.com/en/topics/linux/what-is-the-linux-kernel
- (n.d.). Operating System – Process Scheduling. Retrieved August 27, 2021, from https://www.tutorialspoint.com/operating_system/os_process_scheduling.htm
- (2020, September 27). Components of Operating System. Retrieved August 27, 2021, from https://www.tutorialandexample.com/components-of-operating-system/
- (n.d.). What is interrupt processing? Retrieved August 27, 2021, from https://www.ibm.com/docs/zosbasics/com.ibm.zos.zconcepts/zconc_interrupts.htm
- Paul Stumpe. (2020, January 27). What Happens when you click your mouse. Retrieved August 27, 2021, from https://dev.to/paulstumpe/what-happens-when-you-click-your-mouse-31d