Lecture Note 7: Computer System & Operating System Overview

advertisement
Lecture Note 7:
Computer System &
Operating System Overview
SEG 3460A/B Computer Processing Systems
Concepts
Semester 1, 2002/2003
Assoc Prof Lim Ee Peng
Topics to be covered
Overview of Computer Systems
Interrupts
I/O Communication Techniques
Overview of Operating System
OS Objectives and Functions
Evolution of OS
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
2
Computer System
“Operating Systems Internals and Design Principles”(fourth
edition), William Stallings, 2001
Basic Elements
Processor: Controls the operation of the computer and
performs its data processing functions. When there is only
on processor, it is often referred to as CPU.
Main Memory
Stores data and programs.
I/O modules
Move data between the computer and its external
environments (e.g., disk drive, network, terminals).
System interconnection
Some structures and mechanisms that provide for
communication among processors, main memory, and
I/O modules.
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
3
Instruction Execution
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
4
Interrupts
All computers provide a mechanism by which other modules
may interrupt the normal processing of the processor.
The Classes of Interrupts (Table 1.1)
Program: Generated by some condition that occurs as a
result of an instruction.
Timer: Generated by a timer within the processor.
I/O: Generated by an I/O controller.
Hardware failure: Generated by a failure such as power
failure.
Interrupt is an interruption of the normal sequence of execution.
After interrupt is completed, the normal program execution is
resumed.
Interrupts are provided primarily to improve processing
efficiency.
E.g., Avoid CPU waiting for slow I/O devices.
CPU can continue to execute other instructions
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
5
Interrupts (cont’d)
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
6
Interrupt Cycle
During the interrupt cycle, the processor checks to see if any interrupts have
occurred, indicated by the presence of an interrupt signal.
If interrupt is pending, the processor suspends execution of the current
program and executes an Interrupt Handling Routine (part of OS).
IHR determine the nature of interrupt and performs whatever actions are
needed.
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
7
Program Timing: Short I/O Wait
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
8
Program Timing: Long I/O Wait
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
9
Interrupt Processing
(IHR)
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
10
Multiple Interrupts
Multiple interrupts can occur close to one another.
Receiving data from communication line
Printing completion
To disable interrupt when executing the interrupt handler
routine.
new interrupts will have to remain pending until the
completion of interrupt handler routine.
does not consider priority of interrupts and time-critical
needs.
To define priorities for interrupts.
High-priority interrupts can interrupt the execution of IHR of
low-priority interrupts.
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
11
Multiple Interrupts (cont’d)
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
12
Communication Techniques
3 Techniques for I/O Operations
Programmed I/O
Interrupt-driven I/O
Direct Memory Access (DMA)
Programmed I/O:
When an I/O instruction is encountered, the processor
issues a command to the appropriate I/O module.
The I/O module performs the requested action and then sets
the appropriate bits in the I/O status register.
The I/O module takes no further action to alert the
processor, i.e., no interrupt.. The processor has to check I/O
status register periodically until the action is completed.
Instruction set includes I/O instructions grouped under:
Control, Test, Read/write
The processor has to wait a long time.
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
13
Types of I/O
Interrupt-driven I/O:
Issue an I/O command to a module and then go on to do some other
useful work.
The I/O module will then interrupt the processor to request service when
it is ready to exchange data with the processor.
The processor then executes the data transfer.
The processor may be working on several different programs at the
same time.
Still require the active intervention of the processor to transfer every
word between memory and an I/O module.
Direct memory access(DMA):
When the processor wishes to read or write a block of data, it issues a
command to the DMA module by sending to the DMA module the
following information:
a) whether a read/write is requested,
b) the address of the I/O device,
c) the starting location in memory to read from or write to, and
d) the number of words to be read or written.
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
14
Figure 1.19 Three Techniques for Input of a Block of Data from External
ComputerDevice
System Overview SEG 3460A/B Computer Processing Systems Concepts
15
Operating System Overview
An operating system (OS) is a program that controls the
execution of application programs and acts as an interface
between the user of a computer and the computer hardware.
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
16
Operating System Overview (cont’d)
3 Objectives of Operating System:
Convenience: more convenient to use
Program creation: facilities like editor, debugger
Program execution
Access to I/O devices
Control access to files
System access: share and protection
Error detection and response
Accounting
Ability to evolve: be constructed in such a way as to permit the effective
development, testing, and introduction of new system functions without
interfering with service.
Hardware upgrades plus new types of hardware
New services: (support a new window system)
Fixes
Efficiency: make the computer system resources be used in an efficient
manner.
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
17
The Operating System as Resource manager
A computer is a set of resources for the movement, storage,
and processing of data and for the control of these functions.
The operating system is responsible for managing these
resources.
The operating system is nothing more than a computer
program.
The operating system functions in the same way as ordinary
computer software; that is, it is a program executed by the
processor.
The operating system frequently relinquishes control and
must depend on the processor to allow it to regain control
Key difference between OS and other programs:
OS can direct processor in the use of other system
resources and in the timing of its execution of other program.
In order to do this, processor must cease executing OS and
execute other programs, i.e., OS relinquishes control of
processor.
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
18
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
19
The Evolution of Operating Systems
Serial Processing: Use card reader. No operating system.
Simple Batch Systems: use a piece of software known as the
monitor. So users no longer have direct access to the machine.
Multiprogrammed Batch Systems:
There must be enough memory to hold the operating system
and many user programs.
Now, when one job needs to wait for I/O, the processor can
switch to the other job. The process is known as
multiprogramming, or multitasking.
It is the central theme of modern operating systems.
A multiprogramming batch system must rely on certain
computer hardware features such as I/O interrupts and DMA.
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
20
Computer System Overview SEG 3460A/B Computer Processing Systems Concepts
21
Time-Sharing Systems
It is desirable to provide a mode in which the user interacts directly with the
computer.
Batch Multiprogramming
Time Sharing
Principal
objective
Maximize processor use
Minimize response
time
Job control language
Commands entered
Source of
instructions provided with the at the terminal
instructions to
operating system job
• One of the first time-sharing operating systems: Compatible Time-Sharing
System (CTSS)
• Run on a machine with 32K 36-bit words of main memory, with the resident
monitor consuming 5K of that. When control was to be assigned to an
interactive user, the user’s program and data were loaded into the remaining
27K of main memory. A system clock generated interrupts at a rate of
approximately one every 0.2 seconds. At each clock interrupt, the operating
system regained control and could assign the processor to another user. To
preserve the old user’s status for later resumption, the old user’s programs and
data were written out to disk before the new user’s programs and data were
Computer
System Overview SEG 3460A/B Computer Processing Systems Concepts
22
read in.
Download