COSI 31a: Spring 2009
Midterm Review
Hardware
- CPU
- ALU
- Functional Unit
- registers (status)
-
Memory addressing modes
- direct
- immediate operand
- index
- indirect
- relative
- Assembly language
-
Devices
- terms
- device controller
- device drive
- buffer
- interrupts
-
I/O
- direct I/O (busy waiting)
- interrupt-driven I/O
- DMA
-
implementation
- interrupts or polling
- interrupt vectors
- interrupt handlers
CPU Sharing Abstractions
-
Sharing memory and protection: kernel and address spaces
- kernel vs user mode
- what is an adddress space, how is it implemented?
- multiprogramming without protection: linker-loader
- multiprogrammed OS with protection
- address translation
-
dual mode of operation protection via strong typing: Java
virtual machine
-
Threads, Address Spaces and Processes
- what are threads, how they are related to processes state?
-
PC, registers, execution stack, address space state: content
of main memory, plus resources such as open files, connections
etc.
-
Threads and Dispatching
-
each thread has illusion of own CPU, yet on uniprocessor, all
threads share the same CPU. How does this work?
- Key concepts: TCB (thread control block), dispatching loop
- User-level vs kernel level threads - what is the difference?
-
Independent vs cooperating threads
-
why do we need cooperating threads?
-
to share resources, speedup when can overlap I/O and
computation
- to obtain modularity.
Performance: CPU Scheduling
-
Scheduling policy goals
- minimize response time
- maximize throughput
- increase resource utilization
- be fair
-
Policy options
- FIFO
- RR
- SJF/STCF/SRTCF
- Multilevel feedback queue
- lottery scheduling
-
How to evaluate and compare scheduling policies with respect to
scheduling goals?
Correctness: Synchronization
-
Key concepts
- race condition
- mutual exclusion
- critical section
- synchronization primitives
-
Implementing Mutual Exclusion
-
Hardware support for synchronization, building higher level
sychronization programming abstractions on top of hardware
support.
-
load/store, disable interrupts, atomic read-modify-write, are
all ways to implement higher level atomic operations
-
Higher-level synchronization primitives
-
Definition of semaphores, example uses: producer/consumer with
bounded buffer; Readers-Writers
-
Definition of monitors, wait and signal, example use: solution
to readers-writers problem
-
Comparison between semaphores and monitors
-
Java threads and synchronization support
-
How to program monitors in Java?
-
Concurrency Conclusion: threads and processes and
high-level synchronization abstract concurrency complexity behind
simpler and cleaner interfaces than what is provided by hardware;
but, programming concurrency remains non-trivial.
Deadlock
- definition of deadlock
- conditions for its occurence
- solutions for breaking and avoiding deadlock