Você está na página 1de 16

Chapter – 1

Operating System
Snapshot
 Introduction
 Operating System
 Early Operating Systems
 Buffering and Spooling
 Batch Processing Systems
 Multi Programming Systems
 Time Sharing Systems
 Parallel Systems
 Distributed Systems
 Real Time Systems
 Summary

Introduction
Operating systems are primarily resource manager. The main resource they
manage is computer hardware in the form of processors, storage, input/output devices,
communication devices, and data. Operating systems perform many functions such as
implementing the user interface, sharing hardware among users, allowing users to share
data among themselves, preventing users from interfering with one another, scheduling
resources among users, facilitating input/output, recovering from errors, accounting for
resource usage, facilitating parallel operations, organizing data for secure and rapid
access, and handling network communications.
The Operating System is a set of programs that are implemented either in the
Software or Firmware to activate the Hardware, in order to maintain the functionality and
resources of the system.

Figure 1.1: Abstract view of the components of a computer system

Operating Systems C-1: Operating System Page 1


An operating system is an important part of almost every computer system. A
computer system can be divided roughly into four components: the hardware, the
operating system, the applications programs, and the users as shown in the figure above.
The hardware - the central processing unit (CPU), the memory, and the input /
output (I/O) devices - provides the basic computing resources. The applications programs
- such as compilers, database systems, games, and business programs - define the ways in
which these resources are used to solve the computing problems of the users. There may
be different users such as people, machines, other computers who try to get different
things done. Accordingly, there may be different applications programs, which solve the
users requests. Thus the operating system controls and coordinates the use of the
hardware among the various applications programs for the various users.
An operating system can be viewed as a resource allocator. The computer system
has many resources (hardware and software) that may be required to solve a problem:
CPU time, memory space, file storage space, I/O devices, and so on. The operating
system acts as the manager of these resources and allocates them to specific programs
and users as and when necessary based on the scheduled tasks. Since there may be many
- possibly conflicting - requests for resources, the operating system must decide which
requests are allocated resources to operate the computer system efficiently and fairly.
A slightly different view of an operating system focuses on the need to control the
various I/O devices and user programs. An operating system is a control program. A
control program controls the execution of user programs to prevent errors and improper
use of the computer. It is especially concerned with the operation and control of I/O
devices.

Early Operating Systems


In the past, efficiency considerations were often more important than
convenience. Operating systems have evolved over the last 40 years through a number of
distinct phases or generations, which correspond roughly to the decades. In the 1940s,
the earliest digital computers had no operating systems. Machine language programs
were entered on punched cards, and assembly languages were developed to speed the
programming process.
The General Motors Research Laboratories implemented the first operating
system in the early 1950s for their IBM 701. The systems of the 1950s generally ran only
one job at a time and smoothed the transition between jobs to get maximum utilization of
the computer system. These were called single-stream batch processing system because
programs and data were submitted in groups or batches.
The 1960s
The systems of the 1960s were also batch-processing systems. They contained
many peripheral devices such as card readers, cardpunches, printers, tape drives and disk
drives. So operating systems designers developed the concept of multiprogramming in
which several jobs are in main memory at once, where a processor is switched from job
to job as needed to keep several jobs advancing while keeping the peripheral devices in
use.

Operating Systems C-1: Operating System Page 2


More advanced operating systems were developed to service multiple interactive
users at once. Interactive users communicate with the computer via terminals which are
on line (i.e. directly connected) to the computer. Time-sharing systems were developed to
multiprogram large numbers of simultaneous interactive users.

Many of the timesharing systems of the 1960s were multimode systems which
supported batch processing as well as real-time. Real-time systems are characterized by
supplying immediate response.

The 1970s
The systems of the 1970s were primarily multimode timesharing systems that
supported batch processing, timesharing, and real-time applications. The TCP/IP
communication standards of the Department of Defense became widely used.
Communication in local area networks (LANs) was made practical and economical by
the Ethernet standard. Encryption received much attention and it became necessary to
encode proprietary or private data.

The 1980s
The 1980s was the decade of personal computers and workstation.
Microprocessor technology evolved to the point that it became possible to build desktop
computers as powerful as the mainframes of the 1970s. Computing was distributed to the
sites at which it was needed rather than bringing the data to be processed to some central,
large-scale, computer installation. Application software packages such as spreadsheet
programs, word processors, database packages, and graphics packages helped drive the
personal computing revolution.
Electronic mail, file transfer and remote database access applications proliferated.
The client/server model became widespread: Clients are network users that need various
services performed: servers are hardware/software network components that perform
these services.

The 1990s and Beyond


In the 1990s people entered the era of true distributed computing in which
computations will be parceled into sub computations that can be executed on other
processors in multiprocessor computers and in computer networks.

Buffering and Spooling

Buffering
Buffer refers to the memory area that stores data while they are transferred
between two devices or between device and application. As Input/Output process transfer
progresses, its speed depends on many factors related to input-output hardware, but
normally unrelated to processor operation.

Operating Systems C-1: Operating System Page 3


With single-buffered input, the channel deposits data in buffer, the processor
processes the data and the channel deposits the next data. While the channel is depositing
the data, no processing on that data may occur and while the data is being processed, no
additional data may be deposited.

A double-buffering system allows overlap of input-output operations with


processing. While the channel is depositing data in one buffer, the processor may be
processing the data in the other buffer. When the processor has finished processing the
data in one buffer, it may process data in another buffer while the channel deposits new
data back into the first buffer. This alternating use of buffers is sometimes called as flip-
flop buffering. This is illustrated in figure 1.2.

The advantages of buffering are:

 Coping with speed mismatch between producer and consumer of data stream.

 Adapting between devices that have different data-transfer sizes.


For example, sequence of packets received over network are reassembled in
buffer to form original message.

Figure 1.2: I/O Buffering Schemes

Operating Systems C-1: Operating System Page 4


Spooling

The term is an acronym for Simultaneous Peripheral Operations On-Line.


Spooling, in essence, uses the disk as a huge buffer, for reading as far ahead as possible
on input devices and for storing output files until the output devices are able to accept
them.

Spooling is also used for processing data at remote sites. The CPU sends the data
via communications paths to a remote printer (or accepts an entire input job from a
remote card reader). The remote processing (processing done at a different place) is done
at its own speed, with no CPU intervention. The CPU just needs to be notified when the
processing is completed, so that it can spool the next batch of data.

Spooling overlaps the I/O of one job with the computation of other jobs. Even in a
simple system, the spooler may be reading the input of one job while printing the output
of a different job. Spooling has a direct beneficial effect on the performance of the
system. For the cost of some disk space and a few tables, the computation of one job can
overlap with the I/O of other jobs. Thus, spooling can keep both the CPU and the I/O
devices working at much higher rates, as shown in the figure 1.3 below:

Figure 1.3: Spooling

Categories of Operating System Functions

The operating system functions can be divided into three broad categories:
• Category 1: Essential Functions - Functions that fulfill the basic aim of an
operating system, namely effective utilization of the computer resources.

• Category 2: Monitoring Functions - Functions concerning collection of


resource utilization and system-performance information.

Operating Systems C-1: Operating System Page 5


• Category 3: Service Functions - Functions that enhance facilities provided to
users.
Information concerning system performance and resource utilization by the users
is necessary for active purposes such as adjustment of OS parameters for performance
improvement, which is known as tuning of OS.

Types of Operating Systems

 Batched

Runs one job at a time. Main Task of OS is:

• To transfer control to the next job

• To batch jobs with similar needs and run through the computer as a group

Single Programmed

 No disk is used

 No job scheduling involved

 Once job enters computer it runs to completion

 Multi Programmed

 Simplest job scheduling

 The job gets CPU until it completes or it requests I/O

 Time- Sharing

Multiple jobs are executed by CPU "at the same time" – CPU is given, to one job
for a period of time and then switches to another.

• Allows one user to run several jobs concurrently

• Allows communication between user and system

• Provides convenient and restricted access to user data stored in memory

• Switching appears so frequently, that for each user and each job it looks
like computer runs particularly that job

Operating Systems C-1: Operating System Page 6


The other types of operating systems are Parallel, Distributed and Real-Time systems.

Batch Processing Systems

Batch Processing System was introduced to reduce operator intervention during


the processing of jobs, which are put together to form a batch. The main function of a
batch processing system is to perform automatic transition from one job to another. A job
monitor or supervisor exists in the lower end of the main store, while a user job is being
processed in the remaining storage. The batch monitor implements all functions of the
batch processing system, as shown in the figure below:

Batch
Monitor
Job n

Batch • User O/P


Of • Job
Jobs • Being
Processed
Job 1

Figure: 1.4: Batch Processing Functionality

Storage

The storage arrangement with batch monitor program and the user job of a batch
sharing the storage involves the design decision of how much storage to reserve for the
monitor program and how much to make available for user jobs of the batch. In the
overlay technique, part of the monitor code is permanently situated in the main storage,
while the other sections of the monitor code are loaded into a transient area of main
storage on demand. Monitor functions such as I/O control, interrupt processing, that are
frequently required during batch processing are located in storage while infrequently
required services like device error recovery, opening and closing of files are loaded into
transient area when required. The storage allocation is shown in the figure 1.5.
Permanently
Allocated
Area

Transient Storage area


Area Allocated to
Batch Monitor

Operating Systems C-1: Operating System Page 7


User Program

Figure: 1.5: Storage Allocation in a Batch Processing System

Sharing and Protection


The effectiveness of a computer system’s utilization introduces the need to share
the system’s hardware and software resources amongst it users involving security. An OS
implements the security through the function of resource allocation and sharing and also
protects a user against undue interference from other users. The function of resource
allocation / deallocation is implicit in job initiation and termination.
In a batch processing, the control statement is processed by batch processing
system component called command interpreter, the job control program or the command
processor.

Multiprogramming Systems

The main purpose of multiprogramming is to increase the system utilization


efficiently. Multiprogramming seeks to eliminate the idle time of the CPU due to I/O
operations by providing multiple computational tasks for the CPU to perform. These are
multiple jobs residing simultaneously in the main store. When a job currently executing
on the CPU needs I/O, the CPU hands over the requirement to an I/O channel or the I/O
processor. This releases the CPU to switch over to the execution of another job. The
following figure 1.6 illustrates the schematic representation of a multiprogramming OS.
The CPU and I/O channel are shown to be busy with different jobs residing in the
storage. Each job in the storage could be a current job of the batch. The resident portion
of OS–the multiprogramming supervisor occupies the lower end of the main storage.

Supervisor
CPU
Job 1
Job 2 I/O
Channel

Seq.
Acces I/O
s
Job n

Figure: 1.6: A Multiprogramming Functionality


Hardware Support
The machine features essential for multiprogramming are:
• I/O Channels and interrupt Hardware

Operating Systems C-1: Operating System Page 8


• Storage Protection
• Privileged mode of CPU Operation
The I/O Channels perform the fundamental function of freeing the CPU for the
duration of an I/O operation.
Storage protection is implemented using the technique of protection keys or
bound registers.

Instructions that enable the multiprogramming supervisor to perform


environmental control tasks are not accessible by the user programs. To deny these
instructions, a special mode of operation called privileged mode is defined for the CPU.
The special instructions can be executed only when the CPU is in the privileged mode.
I/O initiation, termination and status sensing instructions fall into the category of
privileged instructions.
The functions of Multiprogramming Supervisor include the management activities
taking place concurrently by the operating system. The basic function of the supervisor is
one of environment control. Three important aspects of this control function are:

(i) Processor Management - Deciding which program the central


processor should be executing at any given moment.
(ii) Storage Management - Deciding how different storage areas are to be
allocated to different jobs present in the system.
(iii) I/O Management - Deciding how and when to initiate I/O operations
directed at various I/O devices in the system.
Input-Output Management

An OS supports variety of I/O facilities such as access methods for different file
organizations, file security mechanisms etc., supported by modules of file system or
IOCS (Input-Output Control System) components of OS. The I/O requirement is passed
to the supervisor, who analyses the requirements and initiates the I/O on the appropriate
device. Device errors are handled by the supervisor, which organizes automatic error
recovery.
Time Sharing Operating System
If a computer is used in a batch mode, a user submits his program along with a
number of other users and all the jobs are put in a job-queue and fed into the computer. A
number of jobs in the queue are kept in the computer’s memory and a multiprogramming
operating system is invoked which schedules the execution of individual jobs with the
main object of keeping all the units of the computer simultaneously busy.

Using this method the total number of jobs processed by the computer in a given
period is maximized. This is known as maximizing the computer’s throughput. It is more
desirable for an individual user to minimize the time elapsed between the submission of
the job and obtaining the results. This time is known as the turnaround time. If the user is

Operating Systems C-1: Operating System Page 9


able to use the computer to only execute his job and no other jobs, this turnaround time
will be minimum.

During program development it is very desirable for a programmer to observe the


effect of changes in the program on the results. A multi-programmed batch system will
not allow such an interaction to an individual programmer because its aim is to increase
the throughput of a computer system. Time-sharing operating systems were evolved to
give rapid turnaround to an individual user while catering to many users.
It is not economically feasible to allow a single user to use a large computer
interactively as user’s speed of thinking and typing is much slower than the processing
speed of a computer. Thus, the computer would be idle most of the time if a single user
uses it interactively. It is therefore necessary to allow a large number of users, each using
the computer interactively, to time-share the computer. This is achieved by using a time-
sharing operating system.
In a time-sharing system, many video terminals are attached to the computer.
Each user has a terminal available to him. A user can initiate a program from his terminal
and interact with it during its execution. Typically, a user enters a program from a
terminal and corrects any typing errors during program entry. The program is then stored
as a file on disk. The user then compiles his program by invoking a compiler though a
command from the terminal. If any syntax errors are found in the program by the
compiler, they are displayed on the video screen. The user corrects the program with an
editing system and recompiles it from the terminal. When all the syntax errors are
corrected, the program is submitted to the processor for execution. The requisite data is
fed from the terminal during program execution. The data may also be stored in a data
file on disk and fed to the program when it needs it. Errors encountered during execution
of the program are displayed on the terminal. If no errors are found, the answers may
either be displayed on the terminal or stored in a file on disk.

Operating Systems C-1: Operating System Page 10


Figure 1.7: Time-Sharing System

In a time shared computer a number of terminals (around 50) are used


simultaneously and each terminal is provided access to the computer’s resources. The
time-sharing operating system allocates about 20 milliseconds to each terminal during
which a program belonging to this terminal user is executed. In 20 milliseconds, about
20× 10-3 × 106 (=20,000) instructions can be carried out by a processor whose speed is of
the order of 1 million instructions per second. If there are 50 terminals working
simultaneously and if 20 milliseconds is allocated to each terminal, a given terminal will
get the processor’s attention once in every 20 × 50 milliseconds = 1 second. As human
reaction times are a few seconds, a terminal user will not notice any delay in execution.
As the total memory available in a computer is limited, it is not possible to keep the entire
programs of all the users of a time-sharing system simultaneously in the main memory.

Operating Systems C-1: Operating System Page 11


Active

Process is Program must


allocated wait for I/O
CPU time completion

Allotted
time slice
over

READY Wait
I/O Completed

Figure 1.8: Switching between states in Time-Sharing

User 1
(Wait)

User 6
(Ready) User 2
(Active)

CPU

User 5 User 3
(Ready) (Wait)
User 4
(Wait)

(A)

Operating Systems C-1: Operating System Page 12


User 1
(Wait)

User 6
(Ready) User 2
(Ready)

CPU

User 5 User 3
(Active) (Wait)
User 4
(Wait)

(B)

Figure 1.9: User status in a Time-Sharing system


The time-sharing operating system would keep only that portion of a program
which is being executed currently in the main memory. The remaining part is kept in the
disk storage. As and when a segment of a program is to be executed, it is brought back to
the main memory from the disk and the inactive segment sent to the disk. The operations
of transferring programs from the main memory to the disk storage and back is known as
swapping. Figure 1.10 shows Swapping of programs in Time-Sharing system.

Figure 1.10: Swapping of programs in Time-Sharing


Multiprogramming is necessary in a time-sharing system because a number of
program are kept in the disk memory. Thus, one may view a time-sharing operating
system as a multiprogramming operating system with terminals and a job-scheduling
algorithm to aid interaction of users with running programs.
Operating Systems C-1: Operating System Page 13
Supporting Real-Time Applications

A real-time application is one whose correctness of functioning (or behavior)


depends on the promptness with which its computational requirements are satisfied. The
response requirements of an application are determined by the nature of the application.

The response time requirements of a real-time system are critical. The real-time
application and the time-sharing support the foreground activities. The Background
activities are supported by batch processing systems. The following figure illustrates the
operating system supporting a real-time application:

Supervisor
Background
Batch Activities
Processing

Time- Foreground
Sharing Activities
Support

Real-Time
Applications

Figure 1.11: Schematic of an operating system supporting a real-time application

Parallel Systems
Most systems to date are single processor systems; that is, they have only one
main CPU. However, there are multiprocessor systems. Such systems have more than
one processor in close communication, sharing the computer bus, the clock, and
sometimes memory and peripheral devices. These systems are referred to as tightly
coupled systems.
There are several reasons for building such systems. One advantage is increased
throughput. By increasing the number of processors, more work can be done in a shorter
period of time. When multiple processors cooperate on a task, a certain amount of
overhead is incurred in keeping all the parts working correctly. This overhead, plus
contention for shared resources, lowers the expected gain from additional processors.
Another reason for multiprocessor systems is that they increase reliability. In
case if one of the available processors fails, then each of the remaining processors pickup
a share of the work of the failed processor. Thus the entire system runs only a certain
percentage slower, rather than failing altogether.

Operating Systems C-1: Operating System Page 14


Distributed Systems

A recent trend in computer systems is to distribute computation among several


processors. In contrast to the tightly coupled systems in parallel systems, the processors
do not share memory or a clock. Instead, each processor has its own local memory. The
processors communicate with one another through various communications lines, such as
high-speed buses or telephone lines. These systems are usually referred to as loosely
coupled systems, or distributed systems.

The process in a distributed system may vary in size and function. They may
include small microprocessors, workstations, minicomputers, and large general-purpose
computer systems. These processors are referred to by a number of different names, such
as sites, nodes, computers and so on, depending on the context in which they are
mentioned.

Real-Time Systems

A real-time system is used when there are rigid time requirements on the
operation of a processor or the flow of data, and thus is often used as a control device in a
dedicated application. A real-time operating system has well-defined, fixed time
constraints. Processing must be done within the defined constraints, or the system will
fail. A real-time system is considered to function correctly only if it returns the correct
result within any time constraints.
There are two kinds of real-time systems. A hard real-time system guarantees
that critical tasks are completed on time. This goal requires that all delays in the system
be bounded, from the retrieval of stored data to the time that it takes for the operating
system to finish any request made of it.
A less restrictive type of real-time system is a soft real-time system, where a
critical real-time task gets priority over other tasks, and retains that priority until it
completes. Soft real-time systems, however, have more limited utility than hard real-time
systems.

Operating Systems C-1: Operating System Page 15


Summary: -

 The operating system functions can be divided into three broad categories
based on functions namely Essential Functions, Monitoring Functions and
Service Functions.

 Buffer refers to the memory area that stores data while they are transferred
between two devices or between device and application.

 Batch Processing System was introduced to reduce operator intervention


during the processing of jobs, which are put together to form a batch.

 Turn-Around Time is the time taken since the submission of a user job to the
time its output is returned to the user.

 The main purpose of multiprogramming is one of increasing the system


utilization efficiency.

 A real-time system is used when there are rigid time requirements on the
operation of a processor or the flow of data, and thus is often used as a control
device in a dedicated application.

Exercise: -

1. What are the three main purposes of an operating system?

2. List the four steps that are necessary to run a program on a completely
dedicated machine.

3. Define the essential properties of Batch operating systems.

4. Name the categories based on which the operating system is classified.

5. Differentiate between buffering and spooling.

6. Explain in detail the concept of Multiprogramming.

7. Define (a) Turn-Around Time (b) Throughput.

8. Describe the structure of an operating system.

9. Distinguish between distributed and real-time systems.

Operating Systems C-1: Operating System Page 16

Você também pode gostar