Sunday 13 April 2014

What's an Operating System for?

The stock answer is that an Operating System is an abstraction layer which enables application software to be defined independently of the physical hardware the system is actually comprised of. As part of this abstraction, the OS provides support for virtual processes which each get a view of the system as being a set of resources reserved exclusively for that process, so that multiple users can use multiple applications, each of which is a process which exists independently of whatever other processes the system may happen to be running at the time.

But there are many ways to abstract the system resources, and each of these is an Operating System. Then the notion of abstraction breaks down, because the different Operating Systems each abstract a different view of the physical hardware. Thus we have higher-level abstractions called cross-platform Application Programming Interfaces (APIs) which provide uniform abstractions of different operating systems.

But not all Applications are written to use these APIs, so we have Hypervisors which allow one physical machine to run more than one Virtual Machine, each of which can run a different Operating System, and thereby allow one physical machine to run more than one application under different Operating Systems at the same time. These hypervisors are more than virtual Operating Systems, however, because they allow virtual machines to be moved from one physical machine to another without interrupting the application processes.

Operating Systems have various quite independent functions. A substantial part of any OS is a set of File System drivers, which provide applications with a means to read and write files stored on block devices such as disk and tape drives. Another substantial part of any OS is the  provision of a network interface, allowing processes on different machines to communicate. Another function of the Operating System is the shell, which allows the user to launch new processes.

Because an OS manages many processes on behalf of many different users a large part of the functionality of the Operating System is dictated by the need to manage resources such as memory and storage space, network bandwidth and CPU time. Because application programs may be badly written, the OS must provide means to protect the system from the effects of a malfunctioning application process. And because some processes may be deliberately designed to compromise privacy and security of data, some Operating Systems provide means to secure the system from these effects.

Now all of these facilities the OS provides introduce inefficiencies in the application process. For example, instead of simply using available memory and storage as it is needed, an application must request it from the OS, and the OS must balance the needs of the different users and applications. This turns out to be impossible to do in practice, because the OS does not have enough information to be able to decide correctly which applications are most important at any particular time.

So the short answer to the question "What is an Operating System for?" is this:
An Operating System is a hugely complicated computer program, which could never work properly, and which is only necessary because people do not actually know what they want their computer to do.
So if we did know what we wanted the computer to do, then we wouldn't need the Operating System, and the application programs could be made much more reliable and far, far more efficient.

If we could abstract just one general purpose application capable of performing any function anyone could reasonably want a computer to perform, then we could just load that one application into the computer's memory, and we wouldn't need any Operating System. Nor would we need to buy software, nor would we need to upgrade software, ... we could instead get on with using computers for writing music, screenplays, mathematical theorems, letters and books. Now wouldn't that be something worth working for?

No comments:

Post a Comment