Operating systems are bad

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com, or follow me on Twitter.

Joe Armstrong’s book about concurrent fault tolerant programming is full of surprising ideas: I love this idea: computers should not have operating systems, they should simply have libraries that programmers can include when they make programs.

In most programming languages it is easy to write a pure function, whose value depends in a deterministic manner on the inputs to the function, but it is much more difficult, and sometimes impossible, to do things like changing the code in the system, or handling errors in a generic manner, or protecting one programmer’s code from failures in another part of the system. For this reason the programmer makes use of services coered by the operating system—the operating system provides protection zones, concurrency etc usually in the guise of processes.

There is a sense in which the operating system provides “what the programming language designer forgot.” In a language like Erlang an operating system is hardly necessary, indeed the OS just provides Erlang with a number of device drivers, none of the OS mechanisms for processes, message passing, scheduling, memory management etc are needed.

The trouble with using an OS to fill in for deficiencies in the programming language is that the underlying mechanisms of the operating system itself cannot easily be changed. The operating systems’ ideas of what a process is or how to do interprocess scheduling cannot be changed.

By providing the programmer with lightweight processes, and primitive mechanisms for detecting and handling errors an application programmer can easily design and implement their own application operating system, which is specifically designed for the characteristics of their specific problem. The OTP system, which is just an application program written in Erlang, is an example of this.

Post external references

  1. 1
    http://www.erlang.org/download/armstrong_thesis_2003.pdf
Source