Monday, November 27, 2006

Assgn. #2
What is Operating System?

The most important program that runs on a computer. Every general-purpose computer must have an operating system to run other programs. Operating systems perform basic tasks, such as recognizing input from the keyboard, sending output to the display screen, keeping track of files and directories on the disk, and controlling peripheral devices such as disk drives and printers.
For large systems, the operating system has even greater responsibilities and powers. It is like a traffic cop -- it makes sure that different programs and users running at the same time do not interfere with each other. The operating system is also responsible for security, ensuring that unauthorized users do not access the system.
Operating systems can be classified as follows:

• multi-user : Allows two or more users to run programs at the same time. Some operating systems permit hundreds or even thousands of concurrent users.
• multiprocessing : Supports running a program on more than one CPU.
• multitasking : Allows more than one program to run concurrently.
• multithreading : Allows different parts of a single program to run concurrently.
• real time: Responds to input instantly. General-purpose operating systems, such as DOS and UNIX, are not real-time.

Operating systems provide a software platform on top of which other programs, called application programs, can run. The application programs must be written to run on top of a particular operating system. Your choice of operating system, therefore, determines to a great extent the applications you can run. For PCs, the most popular operating systems are DOS, OS/2, and Windows, but others are available, such as Linux.

What are the major components of OS?

An operating system has two functions. It acts as a resource manager on the one side and a virtual machine on the other side. The resource manager of the operating system manages allocation of memory, processing time and disk space. The virtual machine should provide a nice user interface, other than the bare hardware would provide.
UNIX for instance has a resource manager, which allocates memory and processing time in a very efficient way. However the virtual machine leaves a lot to be desired on most UNIX systems. The Apple Macintosh in contrast provides a very nice virtual machine with its graphical user interface, but lacks features like protecting programs from each other and fair distribution of processor time. MS-DOS unfortunately provides neither a powerful resource manager nor a friendly virtual machine.

An operating system provides two main services: Filemanagement and Processmanagement.
Files
Processes
Shells

Files
Files are used to store data and directories are a way of organising files in a hierarchical structure. What UNIX does differently from DOS and other systems is the way it organises different physical storage devices.
In DOS there are individual drive names (actually letters from A to Z) denoting the different drives. In UNIX there is essentially just one virtual drive. All physical drives are sub-directories of this virtual drive or other drives.
Example: In DOS the first floppy disk drive is always A: and the first hard disk is always C:. When copying a file from the floppy disk directory flop_dir to the hard disk directory hard_dir, we issue the following instruction:
copy A:\flop_dir\file C:\hard_dir

Processes
A process is basically a program in execution. It consists of a program, its data, its ownership information (UID), the current position at which the computer is in the programs execution and all the other information needed to run the program. The UNIX operating system will occasionally decide to halt a process running and run another process. This gives every process its fair share of processing time. A process is also halted if it is waiting for some I/O operation to finish, like accessing a printer.
When a process is halted the operating system has to store all the information about the processes current state, so that the process can later be restarted exactly where it left off.
Processes can start other processes. These child processes have exactly the same ownership and permissions as the parent processes. Parents can control their children and send them signals. The operating system can also send signals to processes. Their are a wide variety of signals, and most programs react to signals by dying. There are a number of programs though, which are mostly operating system related and take more intelligent action towards signals sent to them.

Shells
The strict definition of an operating system limits it to only the basic program which runs the computer and provides systems calls to the users' programs. Usually the command interpreter or shell is not considered part of the operating system. But without the shell, which executes users' commands and programs, and is the primary interface between the computer and the user, a computer would be virtually impossible to use.
The basic function of a shell is to allow users to execute programs. Many advanced shells though have features which allow writing of scripts, command-line completion and command-line histories.

Monday, November 20, 2006