Focus on Architecture
Functions of Operating System
• Managing Resources
Access to System Utilities
Access to files
Access to I/O devices
Managing Interrupts & Bus Control (DMA)
Error detection and response
Accounting
• Interactive
• Batch
• Uni-tasking
• Multi-tasking
• Real-Time
Batch Operating System Resident Monitor
• Memory protection
— To protect the Monitor & Utilities
• Timer
— To prevent a job monopolizing the system
• Privileged instructions
— Only executed by Monitor
— e.g. I/O, files
• Interrupts
— Allows for relinquishing and regaining control
• DMA
— Allows for optimizing bus usage
The Case for Multi-programmed Batch Systems
• Multi-programming
— “User” part is sub-divided and shared among active
processes
• Solutions:
— Increase amount of main memory
– Expensive
— Swapping
How Does Swapping Work?
• Partitioning
• Paging
Partitioning
Partitioning:
Splitting memory into sections to allocate to processes
(including Operating System!)
• Variable-sized partitions
—Process is stored into smallest reasonable “hole”
Dynamic partitions
— memory leak
— need periodic compaction
Fixed Partitioning
Effect of Dynamic Partitioning – memory leaks
What about Relocation Challenges?
• Mechanisms:
— Use Base Address
— Automatic (hardware) Conversion
Paging
• Split memory into equal sized, “small” chunks
- Page frames
• Then:
— Allocate the required number page frames to a process
– A process does not require contiguous page frames
• Demand paging
—Do not require all pages of a process in memory
—Bring in pages as required
• Page fault
—Required page is not in memory
—Operating System must swap in required page
—May need to swap out a page to make space
—Perhaps select page to throw out based on recent
history
Paging has a Potential for “Thrashing”
• Solutions
— Good page replacement algorithms
— Reduce number of processes running
— Add more memory
Virtual Memory
• We do not need all pages of a process in memory for
it to run - We can swap in pages only as required
Implications:
• Page Tables can become huge and can’t fit into
memory
— need multiple level tables, or
— inverted tables (Why inverted tables ?)
Alternate Inverted Page Table Structure
Problem with Inverted Page Table
• Unsegmented, unpaged
— virtual address = physical address
— Used in Low complexity, High performance systems
• Unsegmented, paged
— Memory viewed as paged linear address space
— Protection and management via paging (Ex: Berkeley UNIX)
• Segmented, unpaged
— Collection of local address spaces
— Protection to single byte level, Translation table needed is on chip when
segment is in memory, provide predictable access times
• Segmented, paged
— Segmentation used to define logical memory partitions subject to access
control
— Paging manages allocation of memory within partitions (Ex: Unix System V)
OS Review
Scheduling:
uni-programming
multi-programming
time-sharing
Memory management:
partitioning
paging – frames, pages, page fault, page table, logical/physical addr
virtual memory – inverted page table, Translation Lookaside Buffer
segmentation