Title: Chapter 1: Introduction
1Chapter 1 Introduction
- What Is an Operating System?
- Computer System Components
- What is an Operating System for?
- Different Views
- Different Types of Systems
- Migration of Features
2What is an Operating System?
- A program that acts as an intermediary between a
user of a computer and the computer hardware. - Execute user programs and make solving user
problems easier. - Make the computer system convenient to use.
- Use the computer hardware in an efficient manner.
3Computer 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 various application
programs for 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 (people, machines, other computers).
4Abstract View of System Components
5What is an Operating System For?
Beautification Principle
- Goal to make hardware look better than it is
- More regular, uniform
- Instead of lots of idiosyncratic devices
- Easier to program
- E.g. don't have to worry about speeds,
asynchronous events - Closer to what's needed for applications
- Named, variable-length files, rather than disk
blocks - Multiple CPU's, one for each user (in shared
system) or activity (in single-user system) - Multiple large, dynamically-growing memories
(virtual memory)
6What is an Operating System For?
Resource Principle
- Goal to mediate sharing of scarce resources
- Resource - something costs money
- Why Share?
- Expensive devices
- Need to share data
- Cooperation between people
- Problems
- Getting it to work at all
- Getting it to work efficiently
- Utilization keeping all the devices busy
- Throughput getting a lot of useful work done per
hour - Response getting individual things done quickly
- Getting it to work correctly
- Limiting the effects of bugs
- Preventing unauthorized access to data/resources,
modification of data
7Bottom-Up View
Hardware Components
- One or More CPU's
- Fetches instructions one at a time from location
specified by PC - Increments PC after fetching or alters PC for
branch instructions - Responds to "interrupts" by jumping to a
different location - Main Memory
- Memory responds to "load" and "store" requests
from the CPU, one at a time. - I/O Devices - Usually looks like a chunk of
memory to the CPU. - CPU sets options and starts I/O by sending
"store" requests to a particular address. - CPU gets back status and small amounts of data by
issuing "load" requests. - Direct memory access (DMA) device may transfer
large amounts of data directly to/from memory by
doing loads and stores just like a CPU. - Issues an interrupt to the CPU to indicate that
it is done. - Bus (or other communication mechanism)
8Bottom-Up View
Timing Problem
- I/O Devices Millions/billions of times slower
than CPU - Typical PC gt100 MIPS
- Typical disk takes gt 10 ms to get one byte from
disk. Ratio 1M1 - Typical typist 60 wpm (1 word or 5 bytes/sec),
i.e. 200 ms per key-stroke, 20 million
instructions. - Solution
- start disk device
- do 100,000 instructions of other useful
computation - wait for disk to finish.
- Terrible to write debug. And it would change
with a faster disk - Better Solution
- P1 for () start I/O wait for it to finish
- use the data for sth
- P2 for () do some useful computation
- OS takes care of switching back and forth between
processes as appropriate. - Question which process should have higher
priority?
9Bottom-Up View
Space Problem
- Most of the time, a typical program is "wasting"
most of the memory space allocated to it. - Looping in one subroutine (wasting space
allocated to rest of program) - Fiddling with one data structure (wasting space
allocated to other data structures) - Waiting for I/O or user input (wasting all of its
space) - Solution virtual memory
- Keep program and data on disk (100-1000 times
cheaper/byte). - OS automatically copies to memory pieces needed
by program on demand.
10Top-Down View
What does it look like to various kinds of users?
- End User
- Wants to get something done
- Doesn't know/care what an OS is
- May not even realize there is a computer there.
- Application Programmer
- Writes software for end users. Uses
beautified'' virtual machine - named files of unlimited size
- unlimited memory
- read/write returns immediately
- Calls library routines
- some really are just subroutines written by
someone else - sort an array, solve a differential equation,
search a string for a character - others call the operating system
- read/write, create process, get more memory
- Systems Programmer
- Creates abstractions for application programmers
- Deals with real devices
11Operating System Definitions
- Resource Allocator
- Decides how to allocate resources for numerous
and possibly conflicting requests from programs
and users - Allocation should be as fair and efficient as
possible - Control Program
- Supervision of the execution of user programs to
prevent errors and improper use of the computer - Management of operation and control of I/O
devices . - Kernel
- The one program running at all times (all else
being application programs). - Should web browsers and email programs be
included?
12Different Types of Systems
- Mainframe Systems
- Batch Systems
- Multi-Programmed Systems
- Time-Sharing Systems
- Desktop Systems
- Multiprocessor Systems
- Distributed Systems
- Clustered System
- Real -Time Systems
- Handheld Systems
13Mainframe Batch Systems
- Early Computers Run from a Front Console
- Maximize resource use at the expense of ease of
use - Input/output card readers/punches, tape drives,
line printers - User submitted a prepared job (control cards) to
operator - Resident monitor
- Initial control in monitor
- Control transfers to job
- When job completes control transfers pack to
monitor - Operating System
- Always resident in memory
- Reduce setup time by batching similar jobs as a
group - Automatically transfer control from one job to
another - CPU is idle when the running job is waiting for
I/O operation
14Mainframe Multiprogrammed
- Several jobs are kept in main memory
- Selected from job pool - all jobs residing on
disk awaiting for allocation of main memory - CPU is multiplexed among them.
- Switch to and run another job if the running job
needs to wait - CPU is never idle as long as at least one job
needs to execute - OS Concerns
- Job scheduling What if memory is not enough for
all jobs in the pool? - CPU scheduling What if several jobs in memory
are ready to run? - Memory management
- Allocation of devices
15Time-Sharing SystemsInteractive Computing
- Logical Extension of Multi-programming
- Multi-programmed, batch systems did not provide
for user interaction with the computer system - Switch among jobs occurs so frequently that the
users can interact with each running program
allows many users to share the computer
simultaneously - Each user may have at least one process in memory
- I/O may be interactive
- OS Concerns
- To obtain reasonable response time, jobs may have
to be swapped in and out of memory to the disk
virtual memory. - Users need to access data and code, and file
system resides on a collection of disks
disk/file management - Concurrent execution complex CPU scheduling
- To ensure orderly execution process synch and
comm. - Multiprogramming and time-sharing are the central
themes of modern operating systems
16Desktop Systems
- Personal Computers
- Computer system dedicated to a single user.
- I/O devices keyboards, mice, display screens,
printers. - OS Concerns
- Maximize user convenience and responsiveness.
- CPU utilization and protection is no longer a
prime concern - Networking changed the protection requirement,
though - Can adopt technology developed for larger
operating system - Other design decisions still apply, e.g. file
protection - worm/virus detection - May run several different types of operating
systems - Windows, MacOS, Unix, Linux
17Parallel Systems
- Multiprocessor systems with more than one CPU
- In close communication, sharing bus etc
- Tightly coupled system
- Processors share memory and a clock
- Communication usually takes place through the
shared memory. - Advantages
- Increased throughput more work done in less time
- Speed-up ratio with N processors lt N
- Economical
- Share peripherals, mass storage, and power
supplies - Increased reliability
- Fault-tolerant/graceful degradation - the ability
to continue providing service proportional to the
level of surviving hardware
18Parallel Systems (Cont.)
- Symmetric multiprocessing (SMP)
- All processors are peers no master-slave
relationship - Each processor runs an identical copy of the
operating system. - The OS copies communicate as needed
- Many processes can run at once without
performance deterioration. - Most modern operating systems support SMP
- Asymmetric multiprocessing
- Each processor is assigned a specific task
master processor schedules and allocated work to
slave processors. - More common in extremely large systems
- Some OS Concerns
- I/O control ensure the data reach the
appropriate processor - Load balancing avoid the cases where some idle,
others overloaded
19Distributed Systems
- Distribute computation among several physical
processors - Loosely coupled - decentralized
- Each processor has its own local memory
- Communication via network
- Infrastructure LAN, WAN, MAN (metropolitan),
small-area, etc - Protocol TCP, ATM, etc
- Connection wire, wireless, dialup
- Computing client-server, peer-to-peer, code
migration - Advantages
- Resources sharing
- Computation speed up load sharing
- Reliability
- Communications
20Distributed Systems Client-Server
Compute-server perform actions upon clients
requests and send back results File-server for
clients to create, update, read, and delete files
(ftp) Combination Web server
21Distributed Systems Mobile Agents
- Mobile Agents
- Autonomy
- Code Mobility strong/weak
- Advantages
- Conservation of bandwidth
- Reduction in total completion time and latency
- Dynamic load balancing
- Support disconnected operation in mobile
environment - Issues
- Security
- Performance analysis
22Clustered Systems
- What is a Clustered System?
- Computers share storage and closely linked via
LAN for computation work - In between multi-processor systems and
distributed systems - Asymmetric clustering
- A hot-standby server monitors active servers and
becomes active when one server fails. - Symmetric clustering
- All N hosts are running the application and
monitoring each other. - Advantage high reliability
- Each node monitors one or more of the others
- When a computer fails, the client would only see
a brief interruption of service
23Real-Time Systems
- What Is a Real-Time System?
- System behaviors depend on timing constraints.
- Often situated e.g. read sensor data and adjust
controls - Quick response is not a mandatory requirement to
a time-sharing system - Bounded response time constraints
- If a task is not completed on time, it may cause
a breakdown or degradation of performance - Applications
- Control device in a dedicated application
- Controlling scientific experiments, medical
imaging systems, industrial control systems,
home-appliance controllers, weapon systems. - Issues
- Scheduling
- Memory management
- Hard vs Soft Real-Time
24Real-Time Systems (Cont.)
- Hard Real-Time
- Guarantees that critical tasks be completed on
time (deadline) - Requires all delays in system be bounded
- Secondary storage limited or absent, data stored
in short term memory, or ROM - Conflicts with time-sharing systems
- Not supported by existing general-purpose OSs.
- Intend to separate users from hardware, which
results in uncertainty about the amount of time
an operation will take - Soft Real-Time
- A critical task gets priority over other tasks.
- OS kernel delays need to be bounded
- A task cannot be kept waiting indefinitely
- Lack of deadline support and limited utility in
industrial control of robotics - Useful in applications (multimedia, virtual
reality).
25Handheld Systems
- Handheld Systems
- Examples PDAs, cell phones
- Convenience and portability vs limited
functionality - Challenges limited size
- Limited memory 512K-8M
- Memory management return allocated memory when
not used - Slow processors
- Faster processor needs more power
- Small display screens lt 3 inches
- Pages must be condensed onto smaller displays
- Wireless connection
- Remote access to e-mail and web browsing
26Migration of Operating-System Concepts and
Features
27Summary
- General Purposes of Operating Systems
- Performance and convenience
- Resource allocator and control
- Different Types of Systems
- Batch Systems
- Multi-Programmed Systems
- Time-Sharing Systems
- Desktop Systems
- Multiprocessor Systems
- Distributed Systems
- Clustered System
- Real -Time Systems
- Handheld Systems
- OS Issues
- Process, CPU, memory, storage, protection