COMP 3511: Lecture 3
Date: 2024-10-02 02:10:47
Reviewed:
Topic / Chapter:
summary
❓Questions
Notes
Storage / IO
-
Cache levels
-
range of timescales
name time (ns) L1 cache reference 0.5 branch mispredict 5 L2 cache reference 7 mutex lock/unlock 25 main memory reference 100 compress 1K bytes w/ Zippy 3,000 send 2K bytes w/ 1 Gbps net 20,000 read 1 MB sequentially from memory 250,000 round trip within same data center 500,000 disk seek 10,000,000 read 1 MB sequentially from disk 20,000,000 send packet CA->Netherlands->CA 150,000,000
-
-
IO subsystem
- OS: accommodate wide variety of devices
- w/ different capabilities, control-bit def., protocol to interact
- OS: enables standard, uniform way of interaction w/ IO
- involving abstraction, encapsulation, and software layering
- encapsulate device behavior in generic classes
- each: accessed through interface: standardized set of functions
- one purpose of OS: hide gap between hardware devices from users
- abstraction & encapsulation!
- IO subsystem: responsible for
- memory management of IO
- buffering: storing data temporarily while being transferred
- caching: storing parts of data in faster storage for performance
- spooling: overlapping / queuing of one job's output as input of other jobs
- typically: printers
- general device-driver interface
- driver for specific hardware devices
- memory management of IO
- OS: accommodate wide variety of devices
-
Direct memory access
- programmed IO: CPU running special IO instructions
- moving byte one-by-one
- between memory & slow devices (keyboard & mouse)
- for fast devices: programmed IO must be avoided
- instead, use direct memory access (DMA) controller
- idea: let IO device and memory transfer data directly
- bypass CPU!
- CPU / OS initialize DMA controller, and it's now responsible for moving data
- benefit: CPU freed from slow IO operations
- OS writes DMA command block into memory
- preparation
- source & destination addresses
- read || write mode
- no. of bytes to be transferred
- execution
- write location of command block to DMA controller
- bus mastering of DMA controller
- i.e. grab bus from CPA
- send interrupt to CPU for signaling completion
- preparation
DMA transfer diagram
- programmed IO: CPU running special IO instructions
Processors
-
Single processor system
- traditionally: most system w/ single processor, single CPU, single processing core
- core: executes instructions & registers for storing data locally
- processing core / CPU: capable of executing a general-purpose instruction set
- such systems: w/ other special-purpose processors
- e.g. device-specific processors (for disk) and graphic controllers (GPU)
- those: w/ limited instruction set
- not executing instructions from user processes
- traditionally: most system w/ single processor, single CPU, single processing core
-
Multiprocessor system
- modern computer (mobile to servers): dominated by multiprocessors system
- traditionally: 2+ processors and each w/ single-core CPU
- speedup ratio: less than no. of processors
- due to overhead - contention for shared resources
- e.g. bus / memory
- multiprocessor advantage
- increased throughput: more computing capability
- economy of scale: share other devices (e.g. IO devices)
- increased reliability: graceful degradation / fault tolerance
- two types of multiprocessor systems
- asymmetric multiprocessing
- master-slave manner
- master processor: assign specific tasks to slaves
- master: handles IO
- symmetric multiprocessing
- each processor: performs all tasks
- including OS functions & user processes
- aka SMP
- each processor: w/ own set of registers and private || local cache
- but all processors: share physical memory via system bus
- each processor: performs all tasks
- asymmetric multiprocessing
- multicore: multiple computing cores inside a single physical chip
- faster intra-chip communication than inter-chip
- using significantly less power: important for mobile / laptops
- modern computer (mobile to servers): dominated by multiprocessors system
-
Non-Uniform Memory Access (NUMA)
- adding more CPU to multiprocessor: may not scale / help
- as system bus can be a bottleneck
- alternative: provide each CPU local memory
- accessed via small & fast local bus
- CPUs: connected by shared system interconnect
- all CPU: share one physical memory address space
- such approach: non-uniform memory access (NUMA)
- potential drawback
- increased latency when CPU must access remote memory across system interconnect
- e.g. memory of another CPU?
- scheduling & memory management implication
- increased latency when CPU must access remote memory across system interconnect
-
Computer system component
- CPU: hardware executing instructions
- processor: physical chip containing one or more CPUs
- core: basic computation unit of CPU
- or: component executing instructions / registers for storing data locally
- multicore: including multiple computing cores on a single physical processor chip
- multiprocessor system: including multiple processors
OS Structure
-
OS structure
- 2 common characteristics exist in all modern OS
- multiprogramming: for efficiency
- aka batch system
- single program: can't keep CPU & I/O busy
- thus multi-program: organize multiple jobs
- s.t. CPU will not stay idle
- in mainframe PC: jobs being submitted remotely & queued
- selected & ran via jab scheduling: load into the memory
- timesharing: logical extension of multiprogramming
- aka multitasking
- CPU: switches frequently between jobs
- s.t. users: can interact w/ each job while running
- enables: interactive computing
- characteristics
- response time:
- each user: w/ at least one program executing in memory (= process)
- if several jobs ready to run: CPU scheduling needed
- if: processes don't fit in memory
- swapping technique required
- moving some program in and out of memory during execution
- virtual memory: allows execution of processes that are not completely in memory
Virtualization
-
Virtualization
- virtualization: abstracts hardware of a single computer
- into multiple different execution environments
- creating illusion: each user / program is running on their "private computer"
- creates: virtual system = virtual machine (VM) to run OS / applications over
- allows: an OS to run as an app within another OS
- 👨🏫 growing industry!
- allows: an OS to run as an app within another OS
- into multiple different execution environments
- components
- host: underlying hardware system
- virtual machine manager (VMM): creates & runs VM by providing interface
- s.t. it's identical to the host
- aka hypervisor
- guest: process provided w/ virtual copy of host
- i.e. program. often: an OS (guest OS)
- allows: a single physical machine to run multiple OS concurrently
- each on their own VM
system models
- virtualization: abstracts hardware of a single computer
-
Virtualization history
- virtualization: OS natively compiled for CPU, running guest OSes
- originally: designed in IBM mainframes (1972)
- for: allowing multiple users to run tasks concurrently
- under: system designed for a single use
- or: sharing batch-oriented system
- for: allowing multiple users to run tasks concurrently
- VMware: runs one or more guest copies of Windows on Intel x86 CPU
- virtual machine manager (VMM): provides environment for programs
- that is: essentially identical to original machine (interface)
- programs on such environment: only experience minor performance decrease (due to extra layers)
- VMM: in complete control of system resources
- originally: designed in IBM mainframes (1972)
- by late 1990s: Intel CPUs on general purpose PCs: fast enough for virtualization
- technology: treated by , which are still relevant today
- virtualization: expended to many OSes, CPUs, VMMs
- virtualization: OS natively compiled for CPU, running guest OSes