CH08 COA9e
CH08 COA9e
CH08 COA9e
William Stallings
Computer Organization
and Architecture
9th Edition
+
Chapter 8
Operating System Support
Computer Hardware and Software
Structure
+
Operating System (OS) Services
The most important system program
Masks the details of the hardware from the programmer and provides
the programmer with a convenient interface for using the system
Boundary between
hardware and software
+ 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 OS is responsible for managing these resources
Interactive system
The user/programmer interacts directly with the computer to request the
execution of a job or to perform a transaction
User may, depending on the nature of the application, communicate with
the computer during the execution of the job
Batch system
Opposite of interactive
The user’s program is batched together with programs from other users and
submitted by a computer operator
After the program is completed results are printed out for the user
+
Early Systems
From the late 1940s to the mid-1950s the programmer
interacted directly with the computer hardware – there was no OS
Processors were run from a console consisting of display lights, toggle switches,
some form of input device and a printer
Problems:
Scheduling
Sign-up sheets were used to reserve processor time
This could result in wasted computer idle time if the user finished early
If problems occurred the user could be forced to stop before resolving the
problem
Setup time
A single program could involve
Loading the compiler plus the source program into memory
Saving the compiled program
Loading and linking together the object program and common functions
+
Memory
Layout
for a
Resident Monitor
+
From the View of the Processor . . .
Processor executes instructions from the portion of main memory containing the monitor
These instructions cause the next job to be read in another portion of main memory
The processor executes the instruction in the user’s program until it encounters an ending or
error condition
Either event causes the processor to fetch its next instruction from the monitor program
The monitor handles setup and scheduling
A batch of jobs is queued up and executed as rapidly as possible with no idle time
Job control language (JCL)
Special type of programming language used to provide instructions to the monitor
Example:
**Each FORTRAN instruction and each item of
$JOB data is on a separate punched card or a separate record on tape. In
addition to FORTRAN and data lines, the job includes job control
$FTN instructions, which are
denoted by the beginning “$”.
... Some Fortran instructions
$LOAD
$RUN
... Some data
$END
Monitor, or batch OS, is simply a computer program
It relies on the ability of the processor to fetch instructions from various portions of main
memory in order to seize and relinquish control alternately
+
Desirable Hardware Features
Memory protection Privileged instructions
User program must not alter the
Can only be executed by the
memory area containing the monitor monitor
The processor hardware should detect If the processor encounters such an
an error and transfer control to the instruction while executing a user
monitor program an error interrupt occurs
The monitor aborts the job, prints an I/O instructions are privileged so
error message, and loads the next job the monitor retains control of all I/O
devices
Timer Interrupts
Used to prevent a job from Gives the OS more flexibility in
monopolizing the system relinquishing control to and
regaining control from user
If the timer expires an interrupt
programs
occurs and control returns to
monitor
System Utilization Example
+
+
Multiprogramming
Example
+
Time Sharing Systems
Example:
If there are n users actively requesting service at one time, each user will
only see on the average 1/n of the effective computer speed
Batch
Multiprogramming
versus
Time Sharing
+
+
Scheduling
Medium-Term Short-Term
Part of the swapping function Also known as the dispatcher
Swapping-in decision is based Executes frequently and makes
on the need to manage the degree
the fine-grained decision of
of multiprogramming
which job to execute next
Swapping-in decision will
consider the memory
requirements of the swapped-out
processes
Five State Process Model
+
Memory Management
Swapping
+
Memory Management
Partitioning
Effect of Dynamic Partitioning
Logical address
- expressed as a location relative to the
beginning of the program
Physical address
- an actual location in main memory
Base address
- current starting location of the process
+
Memory Management
Paging
+
Paging
+
Virtual Memory
Demand Paging
Each page of a process is brought in only when it is needed
Principle of locality
When working with a large process execution may be confined to a small section of a program
(subroutine)
It is better use of memory to load in just a few pages
If the program references data or branches to an instruction on a page not in main memory, a page
fault is triggered which tells the OS to bring in the desired page
Advantages:
More processes can be maintained in memory
Time is saved because unused pages are not swapped in and out of memory
Disadvantages:
When one page is brought in, another page must be thrown out (page replacement)
If a page is thrown out just before it is about to be used the OS will have to go get the page again
Thrashing
When the processor spends most of its time swapping pages rather than executing instructions
+
Inverted Page
Table Structure
Inverted Page
Table Structure
+
Operation of Paging
and Translation
Lookaside Buffer
(TLB)
TLB and
Cache
Operation
+
Segmentation
An executing program may only access data segments for which its clearance
level is lower than or equal to the privilege level of the data segment
Pentium Memory
Management
Formats
Table 8.5 Pentium II Memory Management
Parameters (page 1 of 2)
Table 8.5 Pentium II Memory Management
Parameters (page 2 of 2)
+ Paging
Pentium II
Segmentation may be disabled
In which case linear address space is used
The region can be privileged access only, reserved for use by the OS and not by applications