Sunday, May 11, 2014

What is the purpose of an operating system?

In essence, resource sharing.

Theoretically, you could have a computer that didn't use an operating system; indeed, early computers were basically of this form, where every program contained its own boot instructions and ran directly off the hardware.

But this is inefficient in a number of ways, because most of the memory, processor cycles, and code involved in booting the computer, accessing the keyboard, and displaying on the monitor is going to be the same across many different applications. It makes no sense to make programmers re-invent that wheel every time they write a new program; nor does it make sense to store multiple copies of the same hardware drivers when they all do the same things.

An operating system removes many of these redundancies, providing a common framework for accessing memory, displaying on the screen, receiving input, etc. that all programs can then use. Operating systems are also more secure, as the BIOS and primary operating system can be partitioned off from newly installed programs, and new programs can be denied access to critical hardware. (Whenever you install an app on Android, it specifically asks you if you want it to release the necessary hardware permissions to that app. If you say no, the app won't work; but at least you know which apps are getting access to what hardware.)

Operating systems have another advantage as well, which is that they can allow multitasking. This is a bit of misnomer (for humans as well), because each CPU core can only handle one instruction at a time (so for example a quad-core processor can do at most four simultaneous instructions). What's actually going on is more like task-switching; the operating system can tell when one program has no computations to do at the moment, and free up those processor cycles to give to another program. This happens hundreds of times per second in a typical computer today---a typical switching time is about 10 to 20 milliseconds.

Operating systems can also streamline the experience for users; by using common interfaces like windows, toolbars, and buttons, programmers can make it easier for users to figure out how things work. Again, the use of an operating system allows the code underlying these widgets (they are literally called "widgets") to be re-used instead of re-invented.

No comments:

Post a Comment

How does the choice of details set the tone of the sermon?

Edwards is remembered for his choice of details, particularly in this classic sermon. His goal was not to tell people about his beliefs; he ...