Introduction To Operating System

Introduction To Operating System

A present computer comprises one or more processors, some main memory, disks, printers, a keyboard, a mouse, a display, network interfaces, and several other input/output devices. All in all, a complex system. If every application programmer had to understand how all these things work in detail, no code would ever get written. Moreover, managing all these parts and using them in the best possible way is a challenging job. That's why, computers are prepared with a layer of software called the operating system, whose job is to provide user programs with a better, simpler, cleaner, model of the computer and to handle managing all the resources just mentioned. These systems are the theme of this blog.

The majority of readers will have had some experience with an operating system such as Windows, Linux, FreeBSD, or Max OS X, but looks can be deceiving. The program that users interact with, generally called the shell when it is text based and the GUI (Graphical User Interface) - which is pronounced "gooey"- when it uses icons, is actually not part of the operating system although it uses the operating system to get its work done.

A simple outline of the main components under discussion here is given in the following figure. Here we see the hardware at the bottom. The hardware comprises chips, boards, disks, a keyboard, a monitor, and similar physical things. On top of the hardware is the software. Most computers have two modes of operation: kernel mode and user mode. The operating system is the most essential piece of software and runs in kernel mode (also called supervisor mode). In this mode it has complete access to all the hardware and can carry out any instruction the machine is capable of executing. The rest of the software runs in user mode, in which only a subset of the machine instructions is available. Particularly, those instructions that affect control of the machine or do I/0 (Input/Output) are not allowed to usermode programs. We will come back to the difference between kernel mode and user mode repeatedly throughout this blog.

introduction
The user interface program, shell or GUI, is the lowest level of user-mode software, and permits the user to start other programs, such as a Web browser, email reader, or music player. These programs, too, make heavy use of the operating system.

The placement of the operating system is shown in above figure. It runs on the bare hardware and gives the base for all the other software.

An important difference between the operating system and normal (usermode) software is that if a user does not like a particular e-mail reader, he is free to get a different one or write his own if he so decides; he is not free to write his own clock interrupt handler, which is part of the operating system and is protected by hardware against attempts by users to change it.

This difference, on the other hand, is sometimes blurred in embedded systems (which may not have kernel mode) or interpreted systems (such as Java-based operating systems that use interpretation, not hardware, to separate the components).

Furthermore, in many systems there are programs that run in user mode but which facilitate the operating system or perform privileged functions. For instance, there is often a program that allows users to change their passwords. This program is not part of the operating system and does not run in kernel mode, but it clearly carries out a sensitive function and has to be protected in a special way. In some systems, this idea is carried to an extreme form, and pieces of what is usually considered to be the operating system (such as the file system) run in user space. In these types of systems, it is difficult to draw a clear boundary. Everything running in kernel mode is obviously part of the operating system, but some programs running outside it are arguably also part of it, or at least closely associated with it.

All Operating systems differ from user (i.e., application) programs in ways other than where they reside. Particularly, they are huge, complex, and long-lived. The source code of an operating system like Linux or Windows is on the order of five million lines of code. To imagine what this means, think of printing out five million lines in book form, with 50 lines per page and 1000 pages per volume (larger than this book). It would take 100 volumes to list an operating system of this size-essentially an entire bookcase. Can you imagine getting a job maintaining an operating system and on the first day having your boss bring you to a book case with the code and say: "Go learn that." And this is only for the part that runs in the kernel. User programs like the GUI, libraries, and basic application software (things like Windows Explorer) can easily run to 10 or 20 times that amount.

It should be clear now why operating systems live a long time-they are very hard to write, and having written one, the owner is unwilling to throw it out and start again. Instead, they develop over long periods of time. Windows 95/98/Me was basically one operating system and Windows NT/2000/XP/Vista is a different one. They look similar to the users because Microsoft made very sure that the user interface of Windows 2000/XP was quite similar to the system it was replacing, mostly Windows 98. However, there were very good reasons why Microsoft got rid of Windows 98 and we will come to these when we study Windows in detail in WHAT IS AN OPERATING SYSTEM.

The other major example we will use throughout this blog (besides Windows) is UNIX and its alternatives and duplicates. It, too, has developed over the years, with versions like System V, Solaris, and FreeBSD being derived from the original system, whereas Linux is a fresh code base, though very closely modeled on UNIX and highly compatible with it. We will use examples from UNIX throughout this blog and look at Linux in detail in CASE STUDY 1:LINUX.

In this section we will touch on several key features of operating systems, in brief, including what they are, their history, what kinds are around, some of the basic concepts, and their structure. We will come back to many of these important topics in later articles in more detail.

Tags

operating system, kernel mode, user mode