Professional Documents
Culture Documents
Chapter 6
Operating System Support
1
Chapter 6 – Operating System Support
• In this chapter:
– Overview
– OS History and Structure
– OS Components and Services
– Scheduling
– Memory Management
2
Overview of OS
• Why OS?
– Virtually all computing devices are driven by OS
– PCs, servers, iPods, cell phones, missile guidance systems,
etc. all have an OS that dictate how they operate
– The OS manages many aspects of how programs run, and
how they interact with hardware and the outside world
• So understanding of OS is essential for understanding:
– System performance and reliability
– Resource management
– Virtualization and abstraction
– Concurrency and parallelism
– Hardware interfaces and I/O
3
Overview of OS
• 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
4
Computer System Structure
• Computer system can be divided into four components
Hardware – provides basic computing resources
CPU, memory, I/O devices
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
Word processors, compilers, web browsers, database systems, video games
Users
People, machines, other computers
Overview of OS
• Layers of a
computer system
6
Computer-System Operation
• 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
Computer-System Operation
• Computer-system operation
– Resident Monitor
• Holds initial control, control transfers to job and then back to monitor.
– Problem
• Need to distinguish job from job and data from program.
OS History and Structure
• Batch Systems – Issues:
– Solutions to speed up I/O:
– Offline Processing
• load jobs into memory from tapes, card reading and line
printing are done offline.
– Spooling
• Use disk (random access device) as large storage for reading as
many input files as possible and storing output files until
output devices are ready to accept them.
• Allows overlap - I/O of one job with computation of another.
• Introduces notion of a job pool that allows OS choose next job
to run so as to increase CPU utilization.
OS History and Structure
• Batch Systems - I/O completion
• How do we know that I/O is complete?
– Polling:
• Device sets a flag when it is busy.
• Program tests the flag in a loop waiting for completion of I/O.
– Interrupts:
• On completion of I/O, device forces CPU to jump to a specific
instruction address that contains the interrupt service routine.
• After the interrupt has been processed, CPU returns to code it
was executing prior to servicing the interrupt
– E.g. : FMS, IBSYS
OS History and Structure
• Timesharing
– Hardware – getting cheaper; Human – getting expensive
– Programs queued for execution in FIFO order.
– Like multiprogramming, but timer device
interrupts after a quantum (timeslice).
– Interrupted program is returned to end of FIFO
– Next program is taken from head of FIFO
– Control card interpreter replaced by command
language interpreter.
OS History and Structure
• Timesharing …
– Interactive (action/response)
• when OS finishes execution of one command, it seeks
the next control statement from user.
– File systems
– online filesystem is required for users to access data and code.
– Virtual memory
• Job is swapped in and out of memory to disk
– E.g.: CTSS (M.I.T.), MULTICS (MIT, Bell, GE), UNIX
OS History and Structure
• Parallel Systems
– Multiprocessor systems with more than one CPU in close
communication.
– Improved Throughput, economical, increased reliability.
– Kinds:
• Vector and pipelined
• Symmetric and asymmetric multiprocessing
• Distributed memory vs. shared memory
– Programming models:
• Tightly coupled vs. loosely coupled, message-based vs. shared
variable
OS History and Structure
• Distributed Systems
– Hardware – very cheap ; Human – very expensive
– Distribute computation among many processors.
– Loosely coupled -
» no shared memory, various communication lines
– client/server architectures
– Advantages:
» resource sharing
» computation speed-up
» reliability
» communication - e.g. email
– Applications - digital libraries, digital multimedia
OS History and Structure
• Real-time systems
– Correct system function depends on timeliness
– Feedback/control loops
– Sensors and actuators
– Hard real-time systems -
• Failure if response time too long.
• Secondary storage is limited
– Soft real-time systems -
• Less accurate if response time is too long.
• Useful in applications such as multimedia, virtual reality
Operating System Services
• Program creation
– Editors, debuggers
• Program execution
– Load programs, initialize I/O
• Access to I/O devices
– Hide details, programmer uses read/write
operations
21
OS Components
• Process Management
• Main Memory Management
• File Management
• I/O System Management
• Secondary Storage Management
• Networking
• Protection System
• Command-Interpreter System
Operating System Services
• Controlled access to files
– File formats, protection
• System access
– Access to system resources, resolve conflicts,
protection
• Error detection and response
– Decide on error handling while ensuring minimum
impact on applications
• Accounting
– Collect statistics, monitor performance
23
OS as a Resource Manager
24
OS as a Resource Manager
• The OS controls movement, storage and
processing of data
• However
− The OS functions like any other software – executed
by CPU
− The OS frequently relinquishes control to applications
25
Scheduling
• Essential issue in multi-programming
• Types of scheduling
− Long term
− Decision to add to the pool of processes ready to be
executed
− Medium term
− Decision to add to the pool of processes loaded into memory
− Short term
− Decision to allocate CPU to a process (execute process)
− I/O
− Decision on which process’s I/O request should be handled
by an available I/O device
26
Process Scheduling
27
Memory Management
• Uni-programming
– Memory is split into two parts
• One for operating system (monitor)
• One for currently executing program
• Multi-programming
– Non-O/S (“user”) part is sub-divided and shared
among active processes
28
Swapping
• Problem:
– I/O (printing, network, keyboard, etc.) is so slow
compared with CPU, that even in multi-programming
systems CPU can be idle most of the time
• Solutions:
− Increase size of main memory
− Expensive
− Programmers will eventually use all of this memory for a single
process
− Swapping
− Long term queue of processes stored on disk
− But it is an I/O process - could make the situation worse
29
Partitioning
– Splitting memory into sections to allocate to
processes (including the Operating System)
– Can be fixed-size or variable-size partitions
– Again inefficient
• Paging
– Divide process into small fixed-size chunks
• Virtual Memory
– Part of hard disk allocated as real (main) memory
30
Readings:
• Parallel Processing
Notes/Slides:
• In my office (hard/softcopy)
31
Final Exam:
• Includes:
• Memory Unit
• Input Output
• OS Support
32
The End
33