1.2 DIfferent Types of Operating System and Its Services
1.2 DIfferent Types of Operating System and Its Services
• In earlier days, computers were large machines. The common input devices were card
readers and tape drives.
• The common output devices were tape drives and printers.
• The OS was very simple and always resident in main memory.
• Programmers would prepare a job and submit it to the operator. The job was consisted of
programs and data.
• Operator would make batch by collecting multiple jobs and as computer became available,
run them batch wise.
• At some later time, output appeared. The output consisted of the result of program and
error information if any.
• Programmers needed to wait during this time and then collect output from operator.
Job
Input Output
(Batch of Jobs) OS
• Memory is divided into two parts. It is shared between job and OS.
• At a time one job is selected from the batch of jobs and is loaded in memory for execution.
• Once its execution completes, another job will be selected and loaded in memory for
execution.
• This procedure will continue until all the jobs in a batch get executed.
Disadvantages:
• Low throughput because CPU remains idles when I/O is going on.
• Programmers do not have direct interaction with job.
• Debugging is possible only offline after output appears.
• Operations were too much time consuming.
Advantage:
• The simplest form of multitasking is co-operative multitasking it lets the programs decide
when they wish to let other task run.
• This method is not good since it lets one process use the CPU never let other processes
run.
2. Preemptive multitasking:
• It moves the control of CPU to the OS letting each process to run for a given amount of time
and then switching to another task.
• This is most common today.
• All critical tasks must get completed strictly within specified time limits
• For example system which controls operation of oil refinery.
• A time sharing system allows many users to share the computer resources simultaneously.
• In other words, time sharing refers to the allocation of computer resources in time slots to
several programs simultaneously. For example a Server computer that has many users
logged on to it.
• Each user uses the resources of the server -i.e. memory, CPU etc. The users feel that they are
exclusive user of the CPU, even though this is not possible with one CPU i.e. shared among
different users.
• A time shared system uses CPU scheduling and multiprogramming to provide each user with
a small portion of a time-shared computer.
• It allows many users to share the computer resources simultaneously. As the system
switches rapidly from one user to the other, a short time slot is given to each user for their
executions.
• The time sharing system provides the direct access to a large number of users where CPU
time is divided among all the users on scheduled basis.
• The OS allocates a set of time to each user. When this time is expired, it passes control to the
next user on the system.
• The time allowed is extremely small and the users are given the impression that they each
have their own CPU and they are the sole owner of the CPU.
• This short period of time during that a user gets attention of the CPU; is known as a time
slice or a quantum. The concept of time sharing system is shown in figure.
• Generally, time sharing operating system is used when a powerful server computer serves
several client computers.
• In above figure the user 5 is active but user 1, user 2, user 3, and user 4 are in waiting state
whereas user 6 is in ready status.
• As soon as the time slice of user 5 is completed, the control moves on to the next ready
user i.e. user 6. In this state user 2, user 3, user 4, and user 5 are in waiting state and user 1
is in ready state. The process continues in the same way and so on.
• The time-shared systems are more complex than the multi-programming systems.
➢ Program execution
• Main purpose of OS is to provide an efficient and convenient environment for
Execution of programs so an OS must provide various functions for loading a program into
main memory executes it and after execution terminates it.
➢ I/O Operation
• A running program needs I/O operation s for reading input data and for outputting result.
• This I/O may be with a file or a device.
• User can’t control I/O devices directly for security reasons so OS provides services for I/O
operations.
➢ File System Manipulation
• OS provides file system manipulation functionalities like create, read, write and delete a
file.
➢ Communication
• In multitasking environment more than one process is running
simultaneously.
• Sometime there is a need of exchanging information among processes. Such
processes may be on the same machine or on the different machines. OS
provides inter process communication for this.
➢ Error detection
• Error may be in user programs, CPU and memory hardware or in I/O devices.
• OS detects such errors and makes user aware from them. It also provides
some error recovery mechanism.
➢ Resource allocation
• When multiple users are sharing same machine or when multiple jobs are
runningsimultaneously, there is a need of fair allocation of resources among
them. OS does this.
➢ Accounting
• It is the process of keeping information about which user or process uses
which resourceand for what duration of time.
• OS provides accounting.
➢ Protection
• OS ensures that all access to system resources is controlled and also
provides securityfeatures.