Download Operating system

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Process management (computing) wikipedia , lookup

Unix security wikipedia , lookup

Mobile operating system wikipedia , lookup

Copland (operating system) wikipedia , lookup

Security-focused operating system wikipedia , lookup

Spring (operating system) wikipedia , lookup

Distributed operating system wikipedia , lookup

VS/9 wikipedia , lookup

CP/M wikipedia , lookup

Paging wikipedia , lookup

Transcript
Chapter 1: Introduction
Operating System Concepts – 8th Edition,
Silberschatz, Galvin and Gagne ©2009
Chapter 1: Introduction
 What Operating Systems Do
 Computer-System Organization
 Computer-System Architecture
 Operating-System Structure
 Operating-System Operations
 Process Management
 Distributed Systems
 Computing Environments
Operating System Concepts – 8th Edition
1.2
Silberschatz, Galvin and Gagne ©2009
Objectives
 To provide a grand tour of the major operating systems components
 To provide coverage of basic computer system organization
Operating System Concepts – 8th Edition
1.3
Silberschatz, Galvin and Gagne ©2009
What is an Operating System?
 What is an Operating System?
A program that acts as an intermediary between a user of a computer
and the computer hardware
 Operating system goals:

Execute user programs and make solving user problems easier

Make the computer system convenient to use

Use the computer hardware in an efficient manner
Operating System Concepts – 8th Edition
1.4
Silberschatz, Galvin and Gagne ©2009
Computer System Structure
 Computer system can be divided into four components

Hardware – provides basic computing resources


Operating system


Controls and coordinates use of hardware among various
applications and users
Application programs – define the ways in which the system
resources are used to solve the computing problems of the
users


CPU, memory, I/O devices
Word processors, compilers, web browsers, database
systems, video games
Users

People, machines, other computers
Operating System Concepts – 8th Edition
1.5
Silberschatz, Galvin and Gagne ©2009
Four Components of a Computer System
Operating System Concepts – 8th Edition
1.6
Silberschatz, Galvin and Gagne ©2009
The operating system’s Role
7
 User View:

Single User (personal computer)


Multiple User’s (mainframe or minicomputer)


OS designed to compromise between individual usability and
resource utilization.
Handheld computers (Single user & may connected to networks)


OS designed to maximize resource utilization.
Workstations users connected to networks of other workstations and
servers


OS designed for ease of use , with some attention paid to
performance.
Their operating systems are designed mostly for individual usability
and performance per unit of battery life is important as well.
Embedded computers

If the computers have little or no user view, OS is designed
primarily to run without user intervention (minimize usability)
Operating System Concepts – 8th Edition
1.7
Silberschatz, Galvin and Gagne ©2009
The operating system’s Role (cont.)
8
 System View:

OS is a resource allocator
 Manages all resources (e.g. CPU time, memory space, filestorage space, I/O devices…etc)
 Decides between conflicting requests for efficient and fair
resource use. It is important when many users access the
same mainframe or minicomputer
 OS is a control program
 Controls execution of programs to prevent errors and
improper use of the computer

It is especially concerned with the operation and control of
I/O devices.
Operating System Concepts – 8th Edition
1.8
Silberschatz, Galvin and Gagne ©2009
Operating System Definition
 No universally accepted definition
 Operating System Definition:


It is a software that manage the computer hardware and provide an
environment for application programs to run
“The one program running at all times on the computer” is the kernel.
Everything else is either a system program (ships with the operating
system) or an application program
Operating System Concepts – 8th Edition
1.9
Silberschatz, Galvin and Gagne ©2009
Computer-System Organization
10
 Computer-System Operation
 Storage Structure
 I/O Structure
Operating System Concepts – 8th Edition
1.10
Silberschatz, Galvin and Gagne ©2009
Computer System Organization
 Computer-system operation

A general-purpose computer system consists of

One or more CPU

Multiple device controllers that are connected through a common bus

RAM connecting to CPU and device controllers through common bus

Each device controller is responsible of a specific type of device (e.g.
disk drives, audio devices, and video displays).

The CPU and the device controllers can execute concurrently,
competing for memory cycles . So, a memory controller is provided
whose function is to synchronize access to the memory.
Operating System Concepts – 8th Edition
1.11
Silberschatz, Galvin and Gagne ©2009
Computer-system operation
Operating System Concepts – 8th Edition
1.12
Silberschatz, Galvin and Gagne ©2009
Computer System Operation (cont.)
Computer Startup:
 bootstrap program is loaded at power-up or reboot

Typically stored in ROM or EEPROM, generally known as firmware

Initializes all aspects of system

Loads operating system kernel and starts execution
ROM : read-only memory,
computer memory on which data has been prerecorded.
Once data has been written onto a ROM chip, it cannot be removed and can only be read.
EEPROM: electrically erasable programmable read-only memory.
EEPROM is a special type of PROM that can be erased by exposing it to an electrical charge.
EEPROM retains its contents even when the power is turned off.
firmware: Firmware is software that is embedded in a piece of hardware.
You can think of firmware simply as "software for hardware.“
Typical examples of devices containing firmware are embedded systems (such as traffic lights,
consumer appliances, mobile phones, and digital cameras )
The firmware contained in these devices provides the control program for the device.
Firmware is held in non-volatile memory
Operating System Concepts – 8th Edition
1.13
Silberschatz, Galvin and Gagne ©2009
Computer System Operation (cont.)
Interrupt:
 It is a signal that gets the attention of the CPU
 It generated from either the hardware or the software

Hardware interrupts by sending a signal to the CPU through system
bus.

Software interrupts by executing a special operation called a system
call.

A trap is a software-generated interrupt caused either by an error or a user request
The interrupt is signal that gets the attention of the CPU and is usually
generated when I/O is required.
For example:
• hardware interrupts are generated when a key is pressed or when the
mouse is moved.
• Software interrupts are generated by a program when I/O is required.
Operating System Concepts – 8th Edition
1.14
Silberschatz, Galvin and Gagne ©2009
Storage Structure
 Main memory – only large storage media that the CPU can access directly
 Secondary storage – extension of main memory that provides large
nonvolatile storage capacity
 Magnetic disks – rigid metal or glass platters covered with magnetic
recording material

Disk surface is logically divided into tracks, which are subdivided into
sectors

The disk controller determines the logical interaction between the
device and the computer
Operating System Concepts – 8th Edition
1.15
Silberschatz, Galvin and Gagne ©2009
Storage Structure (cont.)
 All forms of memory provide an array of words. Each
word has its own address.
 Interaction is achieved through a sequence of load or
store instructions to specific memory addresses.

The load instruction>>> moves a word from RAM to CPU’s register

The store instruction>>> moves the content of a CPU’s register to RAM
 CPU automatically loads instructions from main memory
for execution.
Operating System Concepts – 8th Edition
1.16
Silberschatz, Galvin and Gagne ©2009
Storage Structure (cont.)
 Typical instruction-execution cycle :
1.
Fetches an instruction from memory and stores that instruction
in the instruction register .
2.
The instruction is decoded and may cause operands to be
fetched from memory and stored in some internal register.
3.
the instruction on the operands is executed
4.
the result may be stored back in memory.
Operating System Concepts – 8th Edition
1.17
Silberschatz, Galvin and Gagne ©2009
Storage Structure (cont.)
 Storing programs and data in RAM permanently is
impossible because:

RAM is too small to store all needed programs and data
permanently.

RAM is volatile storage device that loses its contents when
power is turned off.
Operating System Concepts – 8th Edition
1.18
Silberschatz, Galvin and Gagne ©2009
Storage Hierarchy
 Storage systems organized in hierarchy

Speed

Cost

size

Volatility
 Caching

It is copying information into faster storage system.

Caches can be installed to improve performance where a large access-time or transfer-rate
disparity exists between two components.
 The design of a complete memory system must balance all the factors just
discussed:

It must use only as much expensive memory as necessary while providing as much
inexpensive, nonvolatile memory as possible.
Operating System Concepts – 8th Edition
1.19
Silberschatz, Galvin and Gagne ©2009
Storage-Device Hierarchy
More expensive and faster
volatile
Operating System Concepts – 8th Edition
can be volatile
or non volatile
Nonvolatile
1.20
Silberschatz, Galvin and Gagne ©2009
I/O Structure
 Storage (e.g. hard disk) is only one of many types of I/O
devices within a computer.
 A large portion of OS code is dedicated to managing I/O,
because of:


Its importance to the reliability and performance of a system
The varying nature of the devices.
Operating System Concepts – 8th Edition
1.21
Silberschatz, Galvin and Gagne ©2009
I/O Structure (cont.)
 A device controller maintains some local buffer storage
and a set of special-purpose registers.
 The device controller is responsible for moving the data
between the peripheral devices that it controls and its
local buffer storage.
 Operating systems have a device driver for each device
controller. This device driver understands the device
controller
Operating System Concepts – 8th Edition
1.22
Silberschatz, Galvin and Gagne ©2009
I/O Structure (cont.)
 Typical I/O operation: (method #1)

The device driver loads the appropriate registers within the device
controller.

The device controller, examines the contents of these registers to
determine what action to take (such as “read “a character from the
keyboard”).

The controller starts the transfer of data from the device to its local
buffer.

Once the transfer of data is complete, the device controller informs the
device driver via an interrupt that it has finished its operation.

The device driver then returns control to the operating system, possibly
returning the data or a pointer to the data if the operation was a read.

This form of interrupt-driven I/O is fine for moving small amounts of data
but can produce high overhead when used for bulk data movement
such as disk I/O.
Operating System Concepts – 8th Edition
1.23
Silberschatz, Galvin and Gagne ©2009
I/O Structure (cont.)
 Direct memory access I/O operation: (method #2)

This method is used to solve the problem of moving bulk data
without causing OS overhead >>>> (to improve performance)

What is direct memory access (DMA) ?

After setting up buffers, pointers, and counters for the I/O device, the device
controller transfers an entire block of data directly to or from its own buffer
storage to memory, with no intervention by the CPU.

Only one interrupt is generated per block, to tell the device driver that the
operation has completed, rather than the one interrupt per byte generated for
low-speed devices.

While the device controller is performing these operations, the CPU is
available to accomplish other work.
Operating System Concepts – 8th Edition
1.24
Silberschatz, Galvin and Gagne ©2009
Computer-System Architecture
 Single-processor systems

It has one CPU capable of executing a general-purpose instruction set,
including instructions from user processes.

Most systems use a single processor (PDAs through mainframes)

Almost all systems have other special-purpose processors

The use of special-purpose microprocessors is common and
does not turn a single-processor system into a
multiprocessor.
Operating System Concepts – 8th Edition
1.25
Silberschatz, Galvin and Gagne ©2009
Computer-System Architecture
 About special-purpose processors :
 They
may come in the form of device-specific processors,
such as disk, keyboard controllers
 Special-purpose
processors run a limited instruction set and
do not run user processes.
 Special-purpose
–
–
processors types:
Managed by the operating system—
»
e.g. A disk-controller microprocessor receives a sequence of
requests from CPU and implements its own disk queue and
scheduling algorithm).
»
This arrangement relieves CPU of the overhead of disk scheduling
(advantage)
special-purpose processors that are low-level components built into
the hardware.
»
Os cannot communicate with these processors; they do their jobs
autonomously.
Operating System Concepts – 8th Edition
1.26
Silberschatz, Galvin and Gagne ©2009
Computer-System Architecture
 MULTIPROCESSOR SYSTEMS

Also known as parallel systems, tightly-coupled systems

have two or more processors in close communication, sharing the
computer bus and some times the clock, memory, and peripheral
devices.

Advantages include:
1.
Increased throughput
»
2.
Economy of scale
»
3.
more work is performed
Multiprocessor systems can cost less than equivalent
multiple single-processor systems, because they can
share peripherals, mass storage, and power supplies.
Increased reliability
»
the failure of one processor will not halt the system,
only slow it down.
Operating System Concepts – 8th Edition
1.27
Silberschatz, Galvin and Gagne ©2009
Computer-System Architecture
 MULTIPROCESSOR SYSTEMS – (CONT.):

Two types
1.
2.
Asymmetric Multiprocessing
–
Each processor is assigned a specific task.
–
master-slave relationship
–
A master processor controls the system; It schedules and
allocates work to the slave processors.
Symmetric Multiprocessing (SMP)
–
Each processor performs all tasks within the operating
system.
–
All CPUs are peers
–
Each processor has its own set of registers & cache
–
All processors share physical memory.
Operating System Concepts – 8th Edition
1.28
Silberschatz, Galvin and Gagne ©2009
Symmetric Multiprocessing Architecture
Operating System Concepts – 8th Edition
1.29
Silberschatz, Galvin and Gagne ©2009
Computer-System Architecture
 SMP pros (++):

many processes can run simultaneously —N processes can run
if there are N CPUs—without causing a significant deterioration
of performance
 SMP Cons (--):

OS must carefully control I/O to ensure that the data reach the
appropriate processor.

since the CPUs are separate, one may be sitting idle while
another is overloaded, resulting in inefficiencies.
 All modern operating systems—including Windows, Mac OS X, and
Linux—now provide support for SMP.
Operating System Concepts – 8th Edition
1.30
Silberschatz, Galvin and Gagne ©2009
Computer-System Architecture
 Multi-cores chips.

It is a recent trend in CPU design is to include multiple
computing cores on a single chip.

Processors were originally developed with only one core.

The core is the part of the processor that actually performs the
reading and executing of the instruction.

Single-core processors can only process one instruction at a
time

Multi-cores chips can be more efficient than multiple chips with
single cores because:


on-chip communication is faster than between-chip communication
one chip with multiple cores uses significantly less power than multiple
single-core chips.
Operating System Concepts – 8th Edition
1.31
Silberschatz, Galvin and Gagne ©2009
A Dual-Core Design

Dual-core processor contains two cores (Such as Intel Core
Duo).

Multi-core systems are especially well suited for server
systems such as database and Web servers.
Operating System Concepts – 8th Edition
1.32
Silberschatz, Galvin and Gagne ©2009
Computer-System Architecture
 Clustered Systems:

they are systems composed of two or more individual systems linked
together. ……(definition)

Represent another type of multiple-CPU system

Like multiprocessor systems, clustered systems have multiple CPUs

Clustered systems differ from multiprocessor systems, in that they are
composed of two or more individual

Clustering is usually used to provide high-availability service.
service will continue even
if one or more systems in
the cluster fail
Operating System Concepts – 8th Edition
1.33
Silberschatz, Galvin and Gagne ©2009
Operating System Structure
 Multiprogramming environment:

Single program cannot keep CPU and I/O devices busy at all times

Multiprogramming increases CPU utilization by organizing jobs (code
and data) so that the CPU always has one to execute.
Multiprogramming idea is as follows:


The operating system keeps several jobs in memory simultaneously .

One job selected and run via job scheduling.

When it has to wait (for I/O for example), OS switches to another job

Eventually, the first job finishes waiting and gets the CPU back.

As long as at least one job needs to execute, the CPU is never idle.
 RAM is too small to accommodate all jobs, the jobs are kept initially on the
disk in the job pool.
 This pool consists of all processes residing on disk awaiting allocation of
main memory.
Operating System Concepts – 8th Edition
1.34
Silberschatz, Galvin and Gagne ©2009
Memory Layout for Multiprogrammed System
Operating System Concepts – 8th Edition
1.35
Silberschatz, Galvin and Gagne ©2009
Operating System Structure
 Time sharing (or multitasking) system:

It is a logical extension of multiprogramming.

In time-sharing systems, the CPU executes multiple jobs by
switching among them, but the switches occur so frequently that
the users can interact with each program while it is running.

Time sharing requires an interactive computer system

The response time should be short ( less than one second)
amount of time it takes from
when a request was submitted
until the first response is
produced.
Operating System Concepts – 8th Edition
1.36
system that provides direct
communication between the
user and the system.
Silberschatz, Galvin and Gagne ©2009
Operating System Structure
 A time-shared operating system allows many users to
share the computer simultaneously. each user is given
the impression that the entire computer system is
dedicated to his use.
 Each user has at least one separate program in memory.
 A process : is a program loaded into memory and
executing
Operating System Concepts – 8th Edition
1.37
Silberschatz, Galvin and Gagne ©2009
Computing Environments
 Traditional Computing
 Client–Server Computing
 Peer-to-Peer Computing
 Web-Based Computing
Operating System Concepts – 8th Edition
1.38
Silberschatz, Galvin and Gagne ©2009
Computing Environments
 Traditional computing

Office environment
 In
past >>>
–
PCs connected to a network or terminals attached to mainframe
–
Remote systems access was difficult
–
Portability was achieved by using laptops
 Now>>>
–

Web portals allowing remote systems access
–
Hand-held computers are used to provide portability
–
Wireless networks is more common and efficient
Home environment
 In
past >>> Used to be single computer, with slow modem
 Now
>>> multiple computers with fast inexpesive internet
connection
Operating System Concepts – 8th Edition
1.39
Silberschatz, Galvin and Gagne ©2009
Computing Environments (Cont)
 Client-Server Computing

Dumb terminals supplanted by smart PCs

Many systems now servers, responding to requests generated by
clients

Server systems can be categorized as:

Compute-server system

provides an interface to which a client can send a
request to perform an action
 the server executes the action and sends back results
to the client. (e.g. database servers )

File-server system

provides interface for clients to store and retrieve files
Operating System Concepts – 8th Edition
1.40
Silberschatz, Galvin and Gagne ©2009
Computing Environments (Cont)
Client-server Structure
Operating System Concepts – 8th Edition
1.41
Silberschatz, Galvin and Gagne ©2009
Peer-to-Peer Computing
 Another model of distributed system
 P2P does not distinguish clients and servers

Instead all nodes are considered peers

May each act as client, server or both
Operating System Concepts – 8th Edition
1.42
Silberschatz, Galvin and Gagne ©2009
Web-Based Computing
 Web has become popular
 PCs most prevalent devices
 More devices becoming networked to allow web access (e.g. handheld
PDA, smart phones….etc)
 New category of devices is appeared: load balancers
 The Web has increased the complexity of devices because their users
require them to be Web-enabled.
is a physical unit that directs
computers to individual servers
in a network, based on factors
such as server processor utilization
Operating System Concepts – 8th Edition
1.43
Silberschatz, Galvin and Gagne ©2009
End of Chapter 1
Operating System Concepts – 8th Edition,
Silberschatz, Galvin and Gagne ©2009
Some Helpful Notes
 Some terminologies :

Usability = ease of use

Utilization= efficiency

Performance= speed

Synchronize = manage the timing

System overhead = more work must be performed by the system
(e.g. more load)

Distributed System: refers to multiple computer systems working
on a single problem.

In distributed computing, a single problem is divided into many parts, and
each part is solved by different computers.

As long as the computers are networked, they can communicate with each
other to solve the problem.
Operating System Concepts – 8th Edition
1.45
Silberschatz, Galvin and Gagne ©2009
Some Helpful Notes (cont.)
 Load & store operations between RAM & CPU is
different from Load & store operations between RAM &
storage devices


Between RAM & CPU :
from RAM to CPU’s register

The load instruction>>> moves a word

The store instruction>>> moves the content of a CPU’s register to RAM
Between RAM & Storage Devices :
from storage device to RAM.

The load instruction>>> moves a word

The store instruction>>> moves a word from RAM to storage device .
Operating System Concepts – 8th Edition
1.46
Silberschatz, Galvin and Gagne ©2009