Professional Documents
Culture Documents
Introduction To Operating Systems
Introduction To Operating Systems
Introduction to
Operating Systems
Grades
15% Attendance
15% Homework
30% Project (2 projects)
15% Presentation (1 chapter)
25% Final Exam
1.2
Reference book
1.3
Chapter 1: Introduction
What Operating Systems Do
Computer-System Organization
Computer-System Architecture
Operating-System Structure
Operating-System Operations
Process Management
Memory Management
Storage Management
Protection and Security
Distributed Systems
Special-Purpose Systems
Computing Environments
Open-Source Operating Systems
1.4
Objectives
1.5
What is an Operating System?
1.6
Computer System Structure
Computer system can be divided into four components
Hardware – provides basic computing resources
Operating system
Operating System
Computer
Hardware
1.8
Operating System Definition
OS is a resource allocator
Manages all resources
1.9
Operating System Definition (Cont)
1.10
Computer Startup
bootstrap program is loaded at power-up or reboot
Typically stored in ROM or EPROM (Firmware)
1 Bootstrap
3
OS 2
OS
CPU
Memory Disk
1.11
Computer System Organization
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
1.12
Computer-System Operation
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
1.13
Common Functions of Interrupts
Interrupt transfers control to the interrupt service
routine (ISR) generally, through the interrupt vector,
which contains the addresses of all the service routines
Interrupt architecture must save the address of the
interrupted instruction
Incoming interrupts are disabled while another
interrupt is being processed to prevent a lost interrupt
A trap is a software-generated interrupt caused either
by an error or a user request
An operating system is interrupt driven
1.14
Interrupt Vector Mouse
Interrupt
Handler Sensors
5
6
Interrupt
7 Handler Network
CPU
4
INT Interrupt I/O
Handler
ISR1 address 3
Keyboard
8
ISRk address Interrupt Vector 2 A
ISRn address
9
ISR1
ISRk
ISRn 10
Buffer
ISRk ISRk
1.17
I/O Structure
1.18
I/O Structure
1.19
Direct Memory Access (DMA) Structure
Used for high-speed I/O devices able to transmit
information at close to memory speeds
Device controller transfers blocks of data from buffer
storage directly to main memory without CPU intervention
Only one interrupt is generated per block, rather than the
one interrupt per byte
Also called cycle stealing, as it steals the CPU execution
cycle to transfer the data blocks.
CPU cycles
Fetch instruction from memory
Fetch data from memory
INT
Execution (w/o memory access)
1.20
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
1.21
Moving-head Disk Mechanism
1.22
Storage Hierarchy
Cost
Volatility
1.23
Storage-Device Hierarchy
1.24
Caching
Important principle, performed at many levels in a
computer (in hardware, operating system, software)
Information in use copied from slower to faster storage
temporarily
Faster storage (cache) checked first to determine if
information is there
If it is, information used directly from the cache (fast)
1.25
How a Modern Computer Works
1.26
Computer-System Architecture
Most systems use a single general-purpose processor (Smart
Phones, PADs, PCs, Notebooks, through mainframes)
Most systems have special-purpose processors as well
Network Processor
1.27
Computer-System Architecture
Multiprocessors systems growing in use and importance
Also known as parallel systems, tightly-coupled systems
Advantages include
1. Increased throughput
2. Economy of scale
3. Increased reliability – graceful degradation or fault
tolerance
Two types
1. Asymmetric Multiprocessing
2. Symmetric Multiprocessing
1.28
Symmetric Multiprocessing Architecture
1.29
Clustered Systems
Like multiprocessor systems, but multiple systems working
together with network
Usually sharing storage via a storage-area network (SAN)
1.30
Operating System Structure
Multiprogramming needed for efficiency
Single user cannot keep CPU and I/O devices busy at all
times
Multiprogramming organizes jobs (code and data) so
CPU always has one to execute
Try to keep CPU as busy as possible
A subset of total jobs in system is kept in memory
1.31
Memory Layout for Multiprogrammed System
Operating
System
CPU Scheduling
Job 1
CPU
Job 2
Job 3
Disk
Memory
Multiprogramming tries to keep CPU as busy as possible
1.32
Operating System Structure
Timesharing (multitasking): CPU switches jobs so
frequently that users can interact with each job while it is
running, creating interactive computing
Response time should be < 1 second
Each user has at least one program executing in
memory process
If several jobs ready to run at the same time CPU
scheduling
If processes don’t fit in memory, swapping moves them
in and out to run
Virtual memory allows execution of processes not
completely in memory
1.33
Memory Layout for Multitasked System
Operating
System
CPU
Job 2
Job 3
Job 2
Job Scheduling
Job 4
1.35
Transition from User to Kernel Mode
Dual-mode operation allows OS to protect itself and other
system components
User mode and kernel mode
Mode bit provided by hardware
Provides ability to distinguish when system is running user code or
kernel code
Some instructions designated as privileged, only executable in
kernel mode
System call changes mode to kernel, return from call resets it to
user
1.36
Process Management
1.37
Process Management
Single-threaded process has one program
counter specifying location of next instruction
to execute
Process executes instructions sequentially,
one at a time, until completion
Multi-threaded process has one program
counter per thread
Typically system has many processes, some
users, some operating system running
concurrently on one or more CPUs
Concurrency by multiplexing the CPUs
among the processes / threads
1.38
Process Management Activities
The operating system is responsible for the following
activities in connection with process management:
Creating and deleting both user and system processes
Suspending and resuming processes
Providing mechanisms for process synchronization
Providing mechanisms for process communication
Providing mechanisms for deadlock handling
1.39
Memory Management
In order to execute, all instructions should stay in memory
All data in memory before and after processing
Memory management determines what is in memory when
Optimizing CPU utilization and computer response to
users
Memory management activities
1. Keeping track of which parts of memory are currently
being used and by whom
2. Deciding which processes and data to move into and out
of memory
3. Allocating and deallocating memory space as needed
1.40
Storage Management
OS provides uniform, logical view of information storage
Abstracts physical properties to logical storage unitfile
Each medium is controlled by device (disk drive, tape
drive)
Varying properties include access speed, capacity, data-
transfer rate, access method (sequential or random)
File-System management
Files usually organized into directories. Access control on
most systems to determine what file who can access
OS activities include
Creating and deleting files and directories
Primitives to manipulate files and directories
Mapping files onto secondary storage
Storage allocation
Disk scheduling
1.42
Performance of Various Levels of Storage
1.43
Migration of Integer A from Disk to Register
1.44
I/O Subsystem
One purpose of OS is to hide complex of hardware devices
from the user
I/O subsystem responsible for
Memory management of I/O including
1.46
Computing Environments
Traditional computer
Office environment
1.48
Peer-to-Peer Computing
Another model of distributed system
P2P does not distinguish clients and servers
All nodes are considered peers
1.49
Web-Based Computing
1.50
Open-Source Operating Systems
Sun Solaris
Android (Google)
1.51
End of Chapter 1