Introduction to Operating System

Download Report

Transcript Introduction to Operating System

midterm
OPERATING SYSTEM
Objectives
At the end of the course, the student should be
able to:
•Define the operating system;
•Demonstrate the abstract view of the
components of a computer system;
•Give the services provided by the operating
system;
•Give examples of operating system used in
early stages of computer system.
Introduction to Operating System
• An operating system is a program that acts
an interface or an intermediary between a
user of a computer and the computer
hardware.
• It is a system program which controls all of
the system ’ s resources and provides an
environment in which a user can execute
programs.
Introduction to Operating System
• The primary goal of an operating system is to
make the computer hardware easier or
convenient to use by handling the details of
all common operations on the hardware such
as:
1. printing data on a printer or screen,
2. copying data from one disk to another,
3. accepting input from a keyboard,
4. loading programs into primary memory and
executing them,
5. and many others.
Introduction to Operating System
• The secondary goal of an operating system is
to use the computer system in an efficient
manner. In other words, to maximize the use
of the computer.
Introduction to Operating System
COMPONENTS OF A COMPUTER SYSTEM
• Computer hardware – the CPU, memory and
I/O devices, provides the basic computing
resources.
• Application programs – such as database
systems, word processors, games and
business programs, define the ways in which
theses resources are used to solve the
computing problems of the users.
Introduction to Operating System
COMPONENTS OF A COMPUTER SYSTEM
• Users – there are many different users
(people, machines, other computers) trying to
solve different problems.
• Operating Systems – the operating system
controls and coordinates the use of the
hardware among the various application
programs for the various users.
Introduction to Operating System
COMPONENTS OF A COMPUTER SYSTEM
USER 1
COM PILER
USER 2
GAM ES
...
...
APPLICATION PROGRAMS
OPERATING SYSTEM
COMPUTER
HARDWARE
USER n
SPREADSHEET
Introduction to Operating System
COMPONENTS OF A COMPUTER SYSTEM
•
The users of the system issue commands to their
respective application programs.
• The application programs in turn communicate the
requests to the operating system.
• The operating system then controls the computer
hardware to carry out the command or request.
Example:
If a user instructs his word processor to print a
particular file, it is actually the operating system, not
the word processor, that does the printing.
Introduction to Operating System
Operating System can be thought of as:
1. Resource Allocator.
The operating system
manages the different computer resources such
as CPU time, memory space, file storage space,
I/O devices, etc. and allocates them to different
application programs and users.
2. Control Program. The operating system controls
the execution of programs to prevent errors and
improper use of the computer. It is especially
concerned with the operation and control of the
I/O devices.
Introduction to Operating System
Services Provided by Operating System
1. Program Execution. The operating system
loads the user program in main memory and
runs it.
2. I/O Operations. The operating system is
responsible for reading and/or writing data
from I/O devices such as disks, tapes, printers,
keyboards, etc.
Introduction to Operating System
Services Provided by Operating System
3. File System Handling. The operating system
takes care of organizing the files within the
disk or tape. It takes care of the creation and
deletion of files for users.
4. Error Detection.
The operating system
should be able to detect errors within the
computer system (CPU, memory, I/O, or user
program) and take the appropriate action.
Introduction to Operating System
Early System
Early computers were purely hardware machines.
• Computers were built with tens of thousands of
vacuum tubes and were rather enormous,
filling up an entire room.
• There were no operating systems.
• A single group of people designed, built,
programmed, operated, and maintained each
machine. But there can be only one user at a
time.
Introduction to Operating System
Early System
Early computers were purely hardware machines.
•Programs were written in machine language (1’s
and 0’s), often by wiring up plug-boards to control
the machine’s basic functions.
Virtually all
problems
were
straightforward
numerical
calculations.
•Computer hardware utilization was not
maximized.
Introduction to Operating System
Early System
Early computers were purely hardware machines.
•
Standard Operating Procedures:
1. A programmer signs up for a block of computer time.
2. The programmer then goes down to the computer
room.
3. The programmer inserts his plug-board into the
computer.
4. The programmer spends the next few hours running
the program. If there are any errors in the program,
he would have to redesign the plug-board and repeat
the entire process again.
Introduction to Operating System
Early System
Early computers were purely hardware machines.
• Because of the time spent in writing and
debugging programs, the computer was idle
most of the time.
Introduction to Operating System
Early System
Improvements in hardware and emergence of
early software.
• The old standard operating procedures had
improved somewhat with the introduction of
better input devices such as the punched card
readers and magnetic tape drives. Programs
were now written on cards.
• Because of these special I/O devices, device
drivers (software that controls these devices)
emerged.
Introduction to Operating System
Early System
Improvements in hardware and emergence of
early software.
• Programs were written in assembly language
mainly because of the arrival of assemblers
(programs that convert assembly language to
machine language).
• Computers were much faster and smaller now
because vacuum tubes were replaced by
transistors.
Introduction to Operating System
Early System
Compilers were invented.
• Programs were written in high-level languages
such as Pascal, COBOL, FORTRAN, etc.
because of the entry of compilers.
•Steps in running a program written in a high-level
language:
1. The programmer takes the card deck or
magnetic tape for the compiler to load the
compiler into the computer.
Introduction to Operating System
Early System
2. The programmer then takes the card deck
for the program to load the program into the
computer.
3. The computer then compiles the program.
This will convert the high-level language
program to assembly language.
4. The programmer then takes the card deck
or magnetic tape for the assembler to load
the assembler into the computer.
Introduction to Operating System
Early System
5. The computer then assembles the program.
This will convert the assembly language
program to machine language.
6. The computer then executes the program.
• There is a significant amount of set-up time
(CPU is idle) in running a single program
(particularly steps 1, 2, and 4).
Introduction to Operating System
Resident Monitor
• To reduce set-up time, jobs with similar needs
were batched together and run through the
computer as a group.
Example:
After loading the FORTRAN compiler, the
operator may compile several FORTRAN
programs. Therefore, setting up the compiler
is done only once for several programs.
Introduction to Operating System
Resident Monitor
• Batched systems require a professional
computer operator. The operator would sort
the different jobs into batches with similar
requirements and, as the computer becomes
available, would run each batch. The output
from each job would be sent back to the
appropriate programmer.
Introduction to Operating System
Resident Monitor
• To reduce the idle time between batches,
automatic job sequencing was developed. A
small program called the monitor was created
for automatically transferring control from one
job to the next. The resident monitor was the
first rudimentary operating system.
Introduction to Operating System
Off-Line Operation
• Even with automatic job sequencing, however,
the CPU is often idle because of the very slow
speed of I/O devices compared to the speed of
the CPU.
• The slowness of the I/O devices can mean that
the CPU is often waiting for I/O.
Introduction to Operating System
Off-Line Operation
•Assume that a program has 1,200 cards. Assume further
the card reader can read 1200 cards per minute (or 20
cards per second) while the CPU can process 300 cards
per second. This means that it will take the card reader
60 seconds to read the cards while the CPU will take only
4 seconds to process the program.
•This means that the CPU will be idle most of the time
(approximately 60 seconds out of a total of 64 seconds or
93.75%).
Introduction to Operating System
Off-Line Operation
• Instead of letting the CPU read directly from the slow
card reader, the cards were copied onto a magnetic
tape. The CPU would then get its input from a
magnetic tape drive (which is much faster than a card
reader).
• In this case, the card reader and the line printer were
operated off-line, not by the main computer.
Introduction to Operating System
Off-Line Operation
• The main advantage of the off-line operation
was that the main computer was no longer
constrained by the speed of slow devices (card
readers and line printers), but was limited by
only the speed of the much faster devices
(magnetic tape drives).
Introduction to Operating System
Buffering
• Buffering is a method of overlapping the I/O of
a job with its own computation.
• Buffering allows input devices to start
transferring data to main memory while the
CPU is busy processing a previous set of data.
By the time the CPU is finished, it can
immediately start processing the new batch of
data.
Introduction to Operating System
Buffering
• Buffering is also applicable to output devices.
In this case, the CPU creates data which is put
into a buffer until an output device can accept
it.
• Buffering is generally an operating system
function.
Introduction to Operating System
Buffering
• If the CPU is, on the average, much faster than
an input device, buffering is of little use. For
I/O-bound jobs (the amount of I/O relative to
the computation, is very great), the CPU will
always find an empty buffer and have to wait
for an input device. For output, the CPU can
proceed at full speed until, eventually, all
system buffers are full.
Introduction to Operating System
Buffering
• For CPU-bound jobs (the amount of
computation is so high), the input buffers are
always full and the output buffers are always
empty. In other words, the CPU cannot keep
up with the I/O devices.
Introduction to Operating System
Spooling
• Although off-line preparation of jobs continued
for some time, it was quickly replaced in most
systems because disk drive systems (which
are much faster than magnetic tape drives)
became widely available and greatly improved
on off-line operation.
• Spooling (Simultaneous Peripheral Operation
On-Line) essentially uses the disk as a very
large buffer.
Introduction to Operating System
Spooling
• When a job is executed, the operating system
gets its input from the disk. Similarly, when the
job requests the printer to output the line, the
line is written to the disk. When the job is
completed, the output is actually printed.
Introduction to Operating System
Spooling
• Buffering overlaps the I/O of a job with its own
computation. The advantage of spooling over
buffering is that spooling overlaps the I/O of
one job with the computation of other jobs.
Example:
The spooler may be reading the input of one
job while printing the output of a different job.
Introduction to Operating System
Multiprogramming
• Multiprogramming increases CPU utilization by
organizing jobs so that the CPU always has
something to do.
• The idea of multiprogramming is as follows:
1. The operating system picks and begins to
execute one of the jobs in the job pool.
2. Eventually, the job may have to wait for
some task (such as an I/O operation) to
complete.
Introduction to Operating System
Multiprogramming
3. Instead to letting the CPU be idle, the
operating system simply switches and
executes another job.
4. Eventually, the first job finishes waiting and
gets the CPU back.
5. As long as there is always some job to
execute, the CPU will never be idle.
Introduction to Operating System
Time Sharing
• Time sharing or multitasking is a logical extension
of multiprogramming.
• A time-shared operating system allows several
users to share the computer simultaneously. Each
user has a separate program in memory. The
operating system allocates the CPU to each user for
a time interval of up to one time quantum or time
slice. As the system switches rapidly from one user
to the next, each user is given the impression that
he has his own computer, whereas actually one
computer is being shared among many users.
Introduction to Operating System
Time Sharing
• Time-sharing allows user to interact with the
system (interactive, or hands-on computer).
The user gives instructions to the operating
system or to the program directly, and receives
an immediate response.
• Usually, a keyboard is used to provide input, and
a display screen is used to provide output.
Introduction to Operating System
Personal Computer Systems
• As hardware costs have decreased, it became
feasible to have a computer system dedicated to a
single user. These types of computer systems are
usually referred to as personal computers, of
just PCs.
• The operating systems for mainframes were quite
different from those designed to work with
personal computers. This is because some of the
design decisions that were made in mainframe
operating systems were not really appropriate for
smaller systems.
Introduction to Operating System
Personal Computer Systems
• In personal computers, the goals of the operating
system have changed.
Instead of trying to
maximize CPU and peripheral utilization, the
systems opt for user convenience and
responsiveness.
Initially, personal computer
operating systems were neither multi-user nor
multitasking.
• However, since more sophisticated hardware are
coming out for personal computers, the features
developed for a large mainframe system have
moved to microcomputers, over time.