Transcript ch01

Operating Systems
Chapter 1
Introduction
Text book: Applied Operating System Concepts
by Silberschatz, Galvin, and Gagne
Module 1: Introduction
What is an operating system?
Simple Batch Systems
Multiprogramming Batched Systems
Time-Sharing Systems
Personal-Computer Systems
Parallel Systems
Distributed Systems
Real -Time Systems
2
What is an Operating System?
§ 1.1
A program that acts as an intermediary between a
user of a computer and the computer hardware.
Purpose: provide an environment in which a user
can execute programs.
Primary goals:
Convenient to use.
Efficient operation of the computer system.
3
Abstract View of System
Components
4
Computer System Components
1. Hardware – provides basic computing resources (CPU,
memory, I/O devices).
2. Operating system – controls and coordinates the use of
the hardware among the various application programs
for the various users.
3. Applications programs – define the ways in which the
system resources are used to solve the computing
problems of the users (compilers, database systems,
video games, business programs).
4. Users – trying to solve different problems (people,
machines, other computers).
5
Operating System Definitions
資源配置
Resource allocator – manages and
allocates resources. (CPU time, memory
space, file-storage space, I/O devices…)
Since there maybe many – possibly
conflicting – requests for resources, the OS
must decide which requests are allocated
resources so that it can operate the
computer system efficiently and fairly.
6
Operating System Definitions
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 .
Kernel – the one program running at all times
(all else being application programs).
核心程式
7
Mainframe Systems
§ 1.2
Batch systems
Multiprogrammed Systems
Time-Sharing Systems
8
Batch Systems
§ 1.2.1
控制台
Early computers were (physically) enormously
large machines run from a console. The common
input devices were card readers and tape drives,
and card punches.
The major task of OS was to transfer control
automatically from one job to the next.
The OS was always resident in memory.
To speed up processing, operators batched
together jobs with similar needs and ran them
through the computer as a group.
9
Memory Layout for
a Simple Batch System
10
Improving batch system
閒置
In batch system, the CPU is often idle, because
the speeds of the mechanical I/O devices are
本質上 intrinsically slower than are those of electronic
devices.
Disk technology allowed the OS to keep all jobs
on a disk and access them directly. It could do
job scheduling to use resources and perform
tasks efficiently. 工作排程
The most important aspect of job scheduling is
the ability to multiprogram.
11
Multiprogrammed Systems
§ 1.2.2
多程式系統
Several jobs are kept in main memory at the
same time, and the CPU is multiplexed among
多路傳輸,多工
them.
Multiprogramming
increases CPU utilization
by organizing jobs such
that the CPU always has
one to execute.
12
OS Features Needed for
Multiprogramming
Job Scheduling – If several jobs are ready to be
brought into memory, and if there is not enough
room for all of them, the the system must choose
among them.
Memory management – the system must
allocate the memory to several jobs.
CPU scheduling – the system must choose
among several jobs ready to run at the same
time.
13
Time-Sharing Systems
分時系統
§ 1.2.3
多工
Time sharing, or multitasking, is a logical
extension of multiprogramming.
An interactive, or hands-on, computer system
provides direct communication between the user
and the system.
A time-shared OS allows the many users to
share the computer simultaneously. As the
system switches rapidly from one user to the
next, each user is given the impression that the
entire computer system is dedicated to her use.
奉獻,專用
14
Time-Sharing Systems
A program that is loaded into memory and is 程序
executing is commonly referred to as a process.
When a process executes, it typically executes
for only a short time before it either finishes or
needs to perform I/O.
Rather than let the CPU sit idle when I/O takes
place, the OS will rapidly switch the CPU to the
program of some other user.
Although some batch processing is still done,
most systems today are time sharing.
15
Desktop Systems
§ 1.3
MS-DOS from Microsoft has been substituted by
Windows and IBM upgraded MS-DOS to the
OS/2 multitasking system.
Apple Macintosh, ported to more advanced
hardware for virtual memory and multitasking.
MacOS X, based on Mach and FreeBSD UNIX
for scalability, performance and features.
Linux
16
Multiprocessor Systems
§ 1.4
Multiprocessor systems with more than one CPU in
close communication.緊密耦合
Tightly coupled system – processors sharing the
computer bus, the clock, and sometimes memory and
peripheral devices. 匯流排
Advantages of parallel system:
Increased throughput
Economical: can share peripherals, mass storage, and power
supplies.
Increased reliability


graceful degradation
Fault tolerant.
17
Symmetric Multiprocessing (SMP)
Each processor runs an identical copy of the
operating system, and these copies
communicate with one another as needed.
Many processes can run at once without
performance deterioration.
Most modern operating systems support SMP
18
Asymmetric Multiprocessing
非對稱
Each processor is assigned a specific task;
master processor schedules and allocates work
to slave processors.
This scheme defines a master-slave relationship.
More common in extremely large systems
19
Off-load to back-ends
As microprocessors become less expensive and
more powerful, additional OS functions are offloaded to slave processors, or back-ends.
For example: add a microprocessor with its own
memory to manage a disk system.
This use of microprocessors has become so
common that it is no longer considered
multiprocessing.
20
Distributed Systems
分散式系統
§ 1.5
Distributed systems depend on networking, a
communication path between two or more
systems, for their functionality.
Networks vary by
TCP/IP
ATM
Protocols used
Distances between nodes
Transport media
Local-area network (LAN)
Wide-area network (WAN)
Metropolitan-area network (MAN)
Small-area network
Copper wires
Fiber strands
Wireless transmission
21
Client-Server Systems
§ 1.5.1
Centralized systems today act as server
systems to satisfy requests generated by client
systems.
Server systems categorized:
Compute-server systems
Clients send requests to perform an action and the server
execute the action and send back results to the client.
File-server systems
Clients can create, update, read and delete files.
22
Client-Server Systems
General Structure:
23
Peer-to-Peer Systems
§ 1.5.2
Networks consist of a collection of processors that do
not share memory or clock and communicate through
communication lines such as buses or phone lines --loosely coupled systems (or distributed systems).
Not only provide connectivity, a network operating
system provides features such as
網路作業系統
provides file sharing
communication scheme for exchange messages.
runs independently from other computers on the network
Distributed Operating System
分散式作業系統
less autonomy between computers
gives the impression there is a single operating system
controlling the network.
24
Clustered Systems
§ 1.6
Clustered systems composed of two ore more
individual systems coupled together sharing
storage and linked closely via LAN.
Provide high availability
A layer of cluster software runs on the cluster nodes.
Each node monitor one or more of the others.
If the monitored machine fails, the monitoring
machine can take ownership of its storage, and
restart the applications.
25
Clustered Systems
Asymmetric Clustering
One machine is in hot standby mode monitoring the
active server while the other machines are running
the applications. If the server fails, the hot standby
host becomes the active server.
Symmetric Clustering
Two or more hosts are running applications, and
they are monitoring each other.
More efficient … uses all available hardware.
26
Parallel Clustering
Parallel clusters allow multiple hosts to access
the same data on the shared storage.
Most OS lack support for that and usually
accomplished by special software.
Ex:
Oracle Parallel Server
Each machine runs Oracle, and a layer of software
tracks access to the shared disk. Each machine has
full access to all data in the database.
27
Distributed File Systems
Most systems do not offer general-purpose
distributed file systems.
Distributed file systems must provide access
control and locking to the files to ensure no
conflicting operations occur, known as
distributed lock manager (DLM)
28
Storage-Area Network (SAN)
Clustered system should expand greatly as
storage-area networks (SANs) become prevalent.
SANs allow easy attachment of multiple hosts to
multiple storage units.
Current clusters are usually limited to two or four
hosts due to the complexity of connecting the
hosts to shared storage.
29
Real-Time Systems
即時系統
§ 1.7
Used when there are rigid time requirements on the
operation of a processor or the flow of data.
Often used as a control device in a dedicated
application such as controlling scientific experiments,
medical imaging systems, industrial control systems,
and some display systems.
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.
Well-defined fixed-time constraints.
30
Real-Time Systems
Hard real-time system.
Secondary storage limited or absent, data stored in
short-term memory, or read-only memory (ROM)
Conflicts with time-sharing systems, not supported
by general-purpose operating systems.
Soft real-time system
A critical real-time task gets priority over other tasks.
Limited utility in industrial control or robotics
Useful in applications (multimedia, virtual reality)
requiring advanced operating-system features.
31
Handheld Systems
§ 1.8
Handheld systems include personal digital
assistants (PDAs), such as Palm or cellular
telephones with connectivity to a network such
as the internet.
Due to limited size, most handheld devices have
small amount of memory
slow processors
small display screens.
32
Feature Migration
§ 1.9
Features that were at one time available on only main
frames have been adopted by microcomputers.
Example: MULTICS (Figure 1.6)
Personal workstation is a large PC – for example, the
Sun SPARCstation, the HP/Apollo, the IBM RS/6000, or
the Intel Pentium system running Windows NT or a
UNIX derivatives.
As PCs gain more sophisticated hardware and software,
the line dividing the mainframes and microcomputers is
blurring.
33
Migration of Operating-System Concepts
and Features
34
Computing Environments
§ 1.10
略
35