1.1 The role of an operating system
Bridging the hardware/user gap
The basic hardware of a computer system consists of a CPU,
random access main memory, secondary storage, typically in the form of a disk,
and input/output (I/O) devices. The CPU repeats a cycle of fetching and
executing low-level machine instructions. In contrast, programmers and casual
users need to think in terms of high-level operations executed on complex data
structures. Most users also do not wish to deal with the internal organizations
and low-level interfaces of disks and other devices. Casual users wish to be
even more remote from computer hardware and only interact with the system using
high-level commands or graphics interfaces.
The mismatch between the low-level capabilities of hardware
and the high-level needs of users must be bridged by system software, including
compilers, interpreters, editors, linkers, and the operating system.
The operating system (OS)
is the software that runs on the bare hardware of a computer and provides
essential support for users to develop and use applications in the most
efficient and safe manner.
Table 1.1.1: Mismatch between hardware
capabilities and user needs.
Hardware component |
Hardware
capabilities |
User
needs |
CPU |
Machine instructions
perform operations on contents of registers and memory locations. |
The user thinks in
terms of arrays, lists, and other high-level data structures, accessed and
manipulated by corresponding high-level operations. |
Main memory |
Physical memory is a
linear sequence of addressable bytes or words that hold programs and data. |
The user must manage
a heterogeneous collection of entities of various types and sizes, including
source and executable programs, library functions, and dynamically allocated
data structures, each accessed by different operations. |
Secondary storage |
Disk and other
secondary storage devices are multi-dimensional structures, which require
complex sequences of low-level operations to store and access data organized
in discrete blocks. |
The user needs to
access and manipulate programs and data sets of various sizes as individual
named entities without any knowledge of the disk organization. |
I/O devices |
I/O devices are
operated by reading and writing registers of the device controllers. |
The user needs
simple, uniform interfaces to access different devices without detailed
knowledge of the access and communication protocols. |
The hardware/user gap is bridged by the OS or by other system software. Which of the following tasks would require OS support?
The OS as a resource manager
An application executes code stored in main memory, reads
data from an input device, and outputs results to a printer or disk.
Performance of the application depends on the efficient use of various devices.
In addition, performance is affected by the presence of other concurrent
applications. One of the main tasks of an OS is to optimize the use of all
computational resources to ensure good overall performance, while satisfying
the requirements of specific applications, including guaranteeing acceptable
response times for interactive processes, meeting deadlines of time-critical tasks,
and allowing safe communication among different tasks.
A program typically alternates between phases of input,
computation, and output. Consequently, the CPU is underutilized during the I/O
phases, while the I/O devices are idle during the compute phase. The overall
performance of all applications can be improved by using concurrency. The OS
strives to keep the CPU, main memory, and all storage and I/O devices busy at
all times by overlapping independent operations whenever possible.
Multiprogramming is a technique that
keeps several programs active in memory and switches execution among the
different programs to maximize the use of the CPU and other resources. Whenever
a program enters an I/O-bound phase where little CPU time is needed, other
programs can resume and utilize the CPU in the meantime. Similarly, whenever a
device completes an operation, the OS activates computations that can utilize
the now available device.
Time-sharing (multitasking)
is an extension of multiprogramming where the CPU is switched periodically
among all active computations to guarantee acceptable response times to each
user. Time-sharing employs the concept of virtualization by creating the
illusion of having a separate virtual CPU for each computation.
No comments:
Post a Comment