In a nutshell, an Operating System acts as the interface between you and your machine. It allows you to communicate with your hardware by being an interface. People often think about personal computers when anyone says Operating System, but an OS is much more than that. There are many different types of operating systems, and each one of them has different jobs. But if we were to say what an operating system does, in summary, we can bring it down to two main functions.
The operating system has two main jobs, and in this post, we will learn about what they are.
Operating System as an Extended Machine
In simple words, operating systems turn ugly hardware into beautiful abstractions.
Definition: Acting as an interface between your software and your hardware is one of the two main jobs of your operating system.
How does the Operating System help in providing a beautiful abstraction?
The architecture of most computers is too primitive to program. Consider the situation of performing a read and write operation onto a floppy disk. The floppy disk is completely obsolete now, and you may not know what it is unless you are a boomer. The ‘save’ icon on most of your programs is that of a floppy disk. It used to be a thing before cloud storage, external hard drives, and flash storage. Anyway, coming back to the point, one of the variants of the floppy disk (PD765) has 16 commands. Each of them is specified by loading between 1 and 9 bytes into a device register.
These commands are for reading and writing data, moving the disk arm, and formatting tracks, as well as initializing, sensing, resetting, and recalibrating the controller and the drives. The most basic command is that of reading and writing. Each of which requires 13 parameters packed into 9 bytes. These parameters mention the address of the disk block to be read, the number of sectors per track, the recording mode used on the physical medium, the intersector gap spacing, and what to do with the deleted data address mark.
If you don’t know what all that is, then you have somewhat understood the point. The OS makes all this an abstraction, instead of writing all that code, everything becomes easy on a graphical user interface. With the development in technology, look how easy it has become to transfer files from one drive to another. It’s a simple drag and drop functionality.
Other uses of OS as an extended machine
It is not just about the floppy disk. You may be wondering, who writes that much onto an external drive anyway? Well, that isn’t the only thing the operating system helps with. This function of the operating system covers all major interactions with the hardware.
- input/output devices.
All these above provide ugly and inconsistent interfaces to the people who have to create software for it. Sometimes it’s for backward compatibility, and sometimes it is to save money.
Operating System as a Resource Manager
Definition: Operating System is responsible for distributing the resources available in your computer (memory, printers, hard disks, etc.) to each program to maintain order in your system.
Looking at the operating system as an extended machine is a top-down view function of the OS. There is another way to look at the OS, the bottom-up view. There are so many abstractions now in the beautiful interface provided by the OS. It must now manage all of these bits of a complex system.
Modern computers are all equipped with processors, memories, timers, disks, mice, printers, and a lot of other devices. Modern computers are also powerful enough to perform multiple tasks at the same time. Multitasking and multiprogramming are what makes a computer a powerful machine.
The problem arises when two or more programs want to use the same resource. When two or more processes are waiting for the same resource, and neither one of them can proceed without the resource, then they come into the position of a deadlock. The Operating System helps in dealing with the deadlocks.
How is a resource manager helpful in Operating Systems?
For example, I have multiple documents open, and I click print. The system shouldn’t print all the pages together on one page. It would become chaotic, so here’s what the Operating System does. It reserves the printer for one document. When that’s done, it gives the go-ahead to the next document to be printed.
The operating system is responsible for distributing memory to each program that is open to avoid crashing down the system. This is known as memory management, and it is a vital part of the OS
This means that one of the two main functions of the OS is to act as a resource manager. It manages the distribution of the resources to various processes. And as it all happens on the beautiful interface, you don’t need to write code for allocating resources to the processes, all that is done by the Operating System.