You are on page 1of 33

Computer Architecture and

Organization (Eeng 3192)

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

– One or more CPUs, device controllers connect through common bus


providing access to shared memory
– Concurrent execution of CPUs and devices competing for memory
cycles
– I/O devices and the CPU can execute concurrently
– Each device controller is in charge of a particular device type
– Each device controller has a local buffer
– CPU moves data from/to main memory to/from local buffers
– I/O is from the device to local buffer of controller
– Device controller informs CPU that it has finished its operation by
causing an interrupt
Operating System Spectrum
• Monitors and Small Kernels
– special purpose and embedded systems, real-time
systems
• Batch and multiprogramming
• Timesharing
– workstations, servers, minicomputers, timeframes
• Transaction systems
• Personal Computing Systems
• Mobile Platforms, devices (of all sizes)
OS History and Structure
• Early Systems - Bare Machine (1950s – 1G)
– Hardware – expensive ; Human – cheap
– Structure
– Large machines run from console
– Single user system
» Programmer/User as operator
– Paper tape or punched cards
– Early software
– Assemblers, compilers, linkers, loaders, device drivers, libraries of common
subroutines.
– Secure execution
– Inefficient use of expensive resources
– E.g. : No OS, only machine languages
OS History and Structure
• Simple Batch Systems (1960’s – 2G)
• Reduce setup time by batching jobs with similar
requirements.
• Add a card reader, Hire an operator
– User is NOT the operator
– Automatic job sequencing
• Forms a rudimentary OS.

– 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

• Multiprogramming (1965-80 – 3G)


– Use interrupts to run multiple programs
simultaneously
– When a program performs I/O, instead of polling, execute
another program till interrupt is received.
– Requires secure memory, I/O for each program.
– Requires intervention if program loops indefinitely.
– Requires CPU scheduling to choose the next job to
run.
– Eg. : OS/360
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

• Personal Computing Systems (4G)


– Hardware – cheap ; Human – expensive
– Single user systems, portable.
– I/O devices - keyboards, mice, display screens, small
printers.
– Laptops and palmtops, Smart cards, Wireless devices.
– Single user systems may not need advanced CPU utilization
or protection features.
– Advantages:
• user convenience, responsiveness, ubiquitous
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

You might also like