The blog provides study material for Computer Science(CS) aspirants. Mostly says "material nahi milta, padhun kahan se.", I think If you can not find content on the Internet, then you are not a CS student. Dedicated to (Prof. Rakesh Kumar, DCSA, K.U.Kurukshetra, HARYANA, INDIA)- "Ek teacher ka bahut jyada padhna, bahut jyada jaroori hota hai."
Sunday, 3 November 2013
Introduction about Operating System
First operating systems (OS) in the modern sense, began to appear in late 1950's. The first OS text book was written by Per Brinch Hansen in 1973.
For more than twenty years OS underwent major changes, but nowadays we have a rather stabilized OS theory.
What is an OS?
OS is a program which acts as an interface between computer system users and the computer hardware. It provides -preferably a user friendly- environment in which a user may easily develop and execute programs. A good OS helps the user use the computer system in an efficient way.
A computer system has some resources which may be utilized to solve a problem. These are:
· Memory (main and secondary) · Processor(s) · File system · I/O devices , etc...
The OS manages these resources and allocates them to specific programs and users. The OS must order the resource allocations, so that the computer system operates fairly and efficiently (Note that there may be many possibly conflicting requests from users and programs).
It all started with only computer hardware. First computers developed were run from a system console. Programs were loaded into memory manually using switches, punched cards, or paper tapes. Then, the starting address of the program was loaded into a special register (program counter) using switches. By pushing a start button, execution was started. The programmer was also the operator. The system could only be used by one person a time. (Similar to single-user microcomputers of today).
As time went on, card readers, printers, and magnetic tape units were developed as additional hardware elements. Assemblers, loaders, and utility program libraries were developed as software tools.
Each new I/O device had its own characteristics and device drivers were written which know how to use the buffers, flags, control and status bits for a particular device. Then compilers were developed for high level languages which made the programmers task much easier. However card readers and LP's were slow, and during I/O, the CPU was idle. To solve this problem off-line spooling was introduced by the help of magnetic tapes (MT).
program program output
CR ----> MT MT ----> CPU CPU ----> LP
By the use of spooling, while one program was being loaded into memory, another one could be loaded onto MT from the CR simultaneously.
Around the beginning of 1960's, channels were developed.
There is a channel program in memory. I/O can be done faster and the processor is now free during I/O time.
Problem: How to communicate with the channel?
Solution: Interrupt (Signal sent from channel to CPU. A routine in the processor checks the status of the channel and decides what to do).
Also buffering was introduced in early 1960's. Thus, instead of doing input character by character, and interrupting the CPU after every character transfer, the channel can go ahead with doing character input into an input buffer. It then sends an interrupt when the buffer becomes full.
Then resident supervisors (monitors) were developed which controlled buffering, interrupts, etc... Resident supervisors were placed in memory at a fixed location, usually in low memory starting at address 0. All users were supposed to use the resident supervisor.
Problem: protection of the use of supervisor area. (Software, hardware control schemes were developed for protection.)
To tell the resident supervisor what to do, job control languages was developed. With the development of disks, users had a faster secondary memory and system programs like compilers were put onto disks and loaded into memory whenever required, instead of having to deal with MT's.
Then came the idea of multiprogramming. Multiprogramming means sharing resources between more than one programs. Device utilization is increased with multiprogramming, by reducing idle times of devices. (it requires several programs to reside in memory at the same time).
.OS picks P2 to execute
wait execute .P2 executes
execute I/0 .P2 needs do I/0. While P2 does I/O
- - OS picks P1 to execute
In multiprogramming systems, disks were used for spooling. With MT's, the CR could not write a program on a MT while the CPU was reading from the other end. (sequential access). However with disks (random access), this problem was eliminated.
On-Line spooling with disks.
Advantage: It overlaps the I/0 of one process with the I/0 computation of other process.
Multiprogrammed OS are more complicated. Since several process are to be kept in memory at the same time, they require some form of memory management. Also whenever the CPU becomes available, the OS will have to choose a process among the ready ones which means the OS must provide device management, concurrency control, protection, and deadlock handling services.
We shall consider modern OS which work under multiprogrammed multiuser environments.
Time-Sharing: (early 1970's)
With batch systems, there was no interaction between the user and his/her program in execution (process) while the program was being executed. Everything was done under operator control. The job was submitted by the user and it was executed at some other time and the output was prepared (the delay between job submission and job completion is called the turnaround time).
Modern computer systems are interactive. The user asks for OS services directly and receives an immediate response. The user can easily experiment and do fast debugging.
Interactive computation + Multiprogramming = Time Sharing
Each user will have a separate program in memory and the CPU is switched rapidly from one user program to the other giving service to all user programs. So, users can share a computer system. As the CPU is switched rapidly between user programs, each user is given the impression that he/she has his/her own computer.
Multiprocessor systems have more than one processing unit sharing memory/peripheral devices. They have greater computing power, and higher reliability. Multiprocessor systems are classified into two:
Tightly-coupled: Each processor is assigned a specific duty but processors work in close association, possibly sharing one memory module.
Loosely-coupled (distributed): Each processor has its own memory and copy of the OS.