Monday, November 10, 2008

Operating Systems

Yesterday, a man asked me what the point of operating systems was.

It's technically possible to do without one, and the first computers had none. The first computers were designed to do one task, and one task alone. If you wanted it to do a different thing, you had to rebuild the computer.

The first development consisted of storing not just the data in memory, but the program too. Now it was possible to have different programs, although only one at a time, and they still had to be written in direct machine language (which is a pain in the ass for even professional programmers.)

Finally, simple operating systems developed. Now you had a standardized environment, adaptable to different computers, that could accept programs written in higher level languages. The personal computer was now possible, although it still didn't happen yet, because computers were still too expensive.

Time-sharing was the next obvious idea, because the institutions that owned computers had many users, and much of a computer's time was spent waiting. One could divide the CPU's attention between all the users in such a way that each could feel they were the computer's only user. This was far more productive -- instead of running one process at a time, one process that spent most of its time waiting, now the computer was running thousands of processes in tiny slices of time. Each ran as fast as if it were the only one, so more of the CPU's time was spent working instead of waiting.

When personal computers became more common than servers, GUIs became popular. The Graphical User Interface (GUI), is more popular than the alternative (Command Line Interface, or "CLI") because most people can point and click faster than they can type. A few expert users prefer CLIs, certainly, but they're a minority of users. Of course, time sharing was still incorporated, because users do want to do more than one thing at a time.

A modern OS must do the following:

* Manage resources such as drivers and memory so that no two programs claim the same piece at the same time (which would be extremely bad.)
* Control the disks so that programs can merely manage files, not disk blocks. Files are simpler for the program.
* Control what program runs when (how much priority does "My budget spreadsheet" have over "Play music" or "Solitaire"?)
* Make sure that no resource runs out. (You get warned if you run low on memory.)
* Manage caches to speed up all access
* Provide a standard interface to programs so that program writers don't have to worry about that crap. Also, programs operate in a similar fashion, so it's easier for the users.
* Be able to stop programs that endanger the operation of the computer (such as programs with endless loops, programs that try to alter each other)
* Most recently, attempt to stop malicious programs, like spyware and viruses.

OSes have significantly bloated over the years. Windows Vista requires more than a gigabyte of RAM to run, and even the tiniest Linux wants 16 megabytes. By comparison, the first personal computer operating systems ran in a few kilobytes. Admittedly, priorities are different now, since memory is now cheap and expansive, and user time more precious, while back then memory was painfully expensive and had to be conserved at all costs.

There is one reversal to this. Microsoft is planning a new release of Windows, which they're only calling "7" for now, which can be installed in 25MB. More typical usage requires 250MB, which most users definitely have now. Why the sudden interest in efficiency? While the typical desktop machine has increasingly expanded capability, there is a big market in notebook computers, which are kind of minimal in capability to maximize battery time. There are also embedded computers, which have little memory and no hard disk, and often boot from specialized Read Only Memory (ROM) chips. Microsoft definitely has an interest in increasing its share of notebook and embedded markets. (Embedded computers are used when the computer will never be directly used by the user, and are typically contained in another device, like a car. The car contains a computer, and you never directly use it, but the car wouldn't work right without the little computer.)

So in short, if you like your computer to do more than one thing, more than one thing at a time, if you like having a variety of cheap programs, and you like your programs to have some standardization, like "CTRL + Q" for "quit" instead of whatever sequence a programmer felt like using today (ESC + CTRL + W + Q + 8), then you definitely want to have an operating system.

No comments:

Related Posts Plugin for WordPress, Blogger...