A Crash Course on Operating Systems
Without an Operating System to interact with, the computer is just a collection of hardware devices. It is therefore essential to learn about the OS as a DevOps or Software Engineer.
In computing, you cannot efficiently get by without interacting with an Operating System. The computer that most everyday users know and interact with is managed by an Operating System.
What is an Operating System
An operating system, by definition, is the foundational computer software on which other software applications run on a computer. It is the software that manages system resources and performs essential services like file management, process management, device management, and many more. The operating system serves as an intermediary between the computer hardware and the user and other applications that make use of the computer hardware resources.
Importance of Learning Operating Systems
As a DevOps Engineer, your primary responsibility would involve setting up, managing, and optimizing infrastructure. This could include CI/CD pipeline infrastructure, monitoring solutions, container orchestration, and other activities, many of which involve interacting with servers that run on Operating Systems. DevOps Engineers work with the operating system every day and carry out many system engineering activities.
Understanding operating system functions like process management, memory management, file management, etc., can help Engineers configure and provide more reliable and better-optimized solutions that run efficiently and effectively.
A very good example is the Kubernetes Administration. Kubernetes orchestrates multiple containers running in a cluster of nodes. The ability to manage the resources of the nodes to handle the container workloads, the skill required to manage volumes for storage and persistence, the knowledge for automating deployments and scaling activities based on system resource utilization and events, the operations and processes that run as jobs and cron job and many other Kubernetes orchestration operations all revolve around operating system concepts and functions (although abstractions might apply in many cases).
Understanding Operating Systems creates a better DevOps Engineer, which is why we will dive into this topic in today’s newsletter.
Functions of an Operating System
First and foremost, the main function of an Operating System is to enable application software to interact with the computer hardware seamlessly and to manage the system’s hardware and software resources.
The operating system must carry out many other functions to do this. Some of the functions of the operating system include:
Process Management
I/O Device Management
File Management
Network Management
Memory Management
Job Accounting
Storage Management
Resource Management
Security Management
Error Detection and Correction
Command Interpretation System
System Performance Control
Process Management
To put it very simply, a process is a program in execution. When a computer program has been written as a file (either a javascript file, c++ file, python file, bash script, or whatever language), it can be compiled or interpreted and loaded into the computer memory where the computer processor can execute the instructions contained in the program. When the program is in a state where it can be handled by the processor, it is known as a process.
So a process is a program or a part of a program that is run on a computer.
The Operating System carries out many activities to manage the processes running on a computer and give them access to efficient computer resources such as CPU time and power, files, memory, or I/O devices.
Device Management
The Operating System has the responsibility of managing device communication between hardware devices and software using its respective drivers. It should provide a layer of abstraction of the hardware devices to keep the details of the device operations from applications while ensuring proper use of devices and preventing errors.
Some Device Management activities that Operating Systems carry out are:
Keeps track of all devices connected to the system. Designates a program responsible for every device known as the Input/Output controller.
Decide which process gets access to a certain device and for how long.
Allocates and Deallocate devices effectively and efficiently
An OS controls the working of multiple input-output devices on a computer system
It processes requests from devices and gives output/feedback back to the device
File Management
File management is one of the most important services of an operating system. A file system is organized into directories for efficient or easy navigation and usage. These directories may contain other directories and other files
Most operating systems organize the structure of their environment in the order of a file system. Users are each given a directory where they can manage and interact with the computer through files they create. They can write programs into a file which can be loaded into the RAM and run as a process for the processor.
This makes files and file management a very important function of an Operating System.
An OS performs the following file management activities:
File creation and deletion
Directory creation and deletion
The support of primitives for manipulating files and directories
Mapping files onto secondary storage
File backup on stable (nonvolatile) storage media
Memory Management
The Primary Memory or Main Memory of the computer is a fast memory that is directly accessible to the processor. It is the fundamental storage unit of a computer which gives the processor access to data while it is performing logic. For a program to be executed, it must first be loaded in the main memory. The allocation and deallocation of various processes to the main memory for execution is carried out by the OS. It also ensures that other processes do not consume the memory allocated to one process.
The Operating System performs memory management activities such as
Keeping track of the available space and used space on the main memory
Keeping track of the memory address spaces for available and unavailable allocation
Allocates the memory to a process when the process requests it and deallocates the memory when the process has terminated
Storage Management
Programs executed on a computer and the data they access must be in the main memory during execution for the processor to be able to have access to them. However, the main memory is often too small to permanently accommodate all data and programs in the computer and also handle memory operations for the processor. Therefore, to improve efficiency, the computer system must also provide secondary storage to back up the main memory.
Most modern computer systems use disks as the hardware for their secondary storage, for both programs and data. Programs, like compilers, assemblers, sort routines, editors, and so on, are stored on the disk until loaded into memory and then use the disk as both the source and destination of their processing.
The operating system is responsible for the following activities in connection with disk management:
Free space management
Storage allocation
Disk scheduling
An Operating System is a complex Software System. Apart from the above-mentioned components and responsibilities, there are many other activities performed by the Operating System. A few of them are listed below:
Security − Operating Systems provide mediums and strategies for securing the computer, including the implementation of authorization, authentication, and defense mechanisms to prevent unauthorized access to programs and data.
Control over system performance − Operating systems are responsible for keeping track of the performance of system hardware by tracking various metrics like delay in processing operations, resource utilization, and more
Job accounting − Keeping track of time and resources used by various jobs and users. Job accounting function refers to when an operating system gathers data which would be used to determine who is using the system and what system resources they are using
Error-detecting aids − Production of logs, dumps, traces, error messages, and other debugging and error-detecting aids.
Coordination between other software and users − Coordination and assignment of compilers, interpreters, assemblers, and other software to the various users of the computer systems.
Types of Operating Systems
Batch Operating Systems
Multiprogramming Operating Systems
Multiprocessing Operating Systems
Multitasking Operating Systems
Network Operating Systems
Distributed Operating Systems
Real-Time Operating Systems
Time Sharing Operating Systems
Batch Operating System
These types of operating systems were very popular and predominant in the 1970s. Most computer users were used to having a single computer in a computer room and they did not all need to interact with the computer directly rather users submit their jobs and similar jobs with the same set of requirements are grouped as a batch and executed in time.
Multiprogramming Operating System
Multiprogramming is an extension of the Batch Operating System. The Multiprogramming OS tries to make better use of resources by keeping more than one program in the main memory at the same time and any of the processes can be executed. In a multiprogramming OS, processes have CPU time and I/O time, if a process waits for I/O operations, then another process can begin execution.
Multiprocessing Operating System
In a multi-processing operating system, more than one CPU is available to handle processing from the main memory. This improves the performance of the system. This means that more than one process can be executed at the same time, thereby improving the throughput (amount of work completed per unit time) of the system.
Multitasking Operating System
This is an extension of the multiprogramming operating system which can run multiple programs simultaneously using scheduling algorithms such as the Round Robin Scheduling Algorithm.
There are two main types of multitasking operating systems:
In Preemptive Mutli-tasking, the Operating System implements a context-switching mechanism that decides how long a process should run before deallocating the CPU from it and allocating it to another process for execution.
In Cooperative Multi-tasking, each process must cooperate with other processes and voluntarily yield control of the CPU periodically to allow other processes to be executed.
Network Operating System
This is the type of operating system that contains the tools, software, and associated protocols to communicate with other computers in the network. They usually run on servers and allow for the management of users, user groups, security, applications, access to shared resources, and other network processes over a shared private network. Computers within the network running a Network OS are usually referred to as tightly coupled systems.
Distributed Operating Systems
These types of systems are a more recent advancement in computing. They consist of various independent computers connected to a shared communication network. Each system is said to be independent and autonomous in that it utilizes its resources (CPU and Memory) which may vary in size and capacity from another computer within the same network. This concept is why a Distributed System is often called a loosely coupled system. A major advantage of a distributed operating system is that a computer can remotely access data or programs on a different computer in the network without having to have it in their local environment.
Time Sharing Operating Systems
In time-sharing operating systems, each task is assigned some time to execute so that all tasks can run seamlessly. Every user would need the time of the CPU to perform his tasks as they all share a single system. The time that each task gets to execute is called quantum.
Each task is assigned a quantum for its execution, and the operating system switches the processor to a different task. This way every task can get CPU time.
Real-Time Operating Systems
Real-Time Operating Systems are used in systems that need the processing and output of results of their inputs served in a very small timeline (real-time). In real-time systems, jobs have a strict timeline that must be adhered to for the result of the output to be relevant and useful. Missing the deadline might lead to a significant impact on the system. Examples include missile systems, air traffic control systems, robots, etc.
Conclusion
In this post, we’ve taken a brief look at the foundational concepts of Operating Systems.
We talked about why it is important to learn and understand operating systems as a DevOps Engineer, then we discussed the various functions and processes of an operating system. We then went over the different types of operating systems that are used in the world today.
In the coming editions of this newsletter, we will take deeper dives into aspects of Operating System processes and other computing and DevOps concepts.
Subscribe to keep learning
Support Our Journey
Our newsletter has the mission of creating valuable learning materials for DevOps and Infrastructure Engineers of all levels. We do the research and simplify complex concepts to make learning and development easier.
If you found this post useful, subscribe to our newsletter and share it with other Engineers in your network.
Subscribe to our paid newsletter for Exclusive Content, Deep Dives, and Behind the Scenes.