run multiple apps simultaneously
better resource utilization
better average response time
better performance
Back
Concurrency
Front
allows multiple applications to run at the same time (juggling)
Back
System Call
Front
entry point call to OS
Back
1st Phase of OS History
Front
Hardware expensive, humans cheap
hardware: mainframes, OS: human operators
Goal: efficient use of hardware
Back
Starvation
Front
process keeps waiting, never ran
Back
Mutli-level feedback queue
Front
drawback: CPU bound job may drop to the bottom of queue and stay forever unless (aged)
Back
Program vs Process
Front
recipe vs everything needed to cook
Back
Master Boot Record (MBR)
Front
The first sector on a hard drive, which contains the partition table and a program the BIOS uses to boot an OS from the drive.
Back
FIFO
Front
best case: all same length
worst case: longest job first
Back
P( )
Front
atomic operation that waits for semaphore to become positive then decrement by 1
Back
V( )
Front
atomic operation that increments semaphore by 1 and wakes up a waiting thread at P( )
Back
User-mode vs kernel mode
Front
application vs execute OS
Back
3rd Phase of OS History
Front
Hardware very cheap, humans very expensive
hardware: personal computers
Goal: allowing a user to perform many tasks at the same time
Back
multithreading
Front
having multiple threads per address space
Back
Cooperating Threads
Front
- shared states
- non-deterministic
- non-reproducible
Back
4th Phase of OS History
Front
Distributed Systems
Hardware: computers with networks
Goal: ease of resource sharing among machines
Back
critical section
Front
a piece of code that only one thread can execute at a time
Back
Per-thread States
Front
Running - has the CPU
Blocked - waiting for the I/O or another thread
Ready to run - on the ready list, waiting for the CPU
Back
Round Robin
Front
optimizes: response time
minimize: turn-around time
Back
Semaphore
Front
- type of lock
- only non-negative integer values (0,1,2....)
Back
process
Front
an address space + at least one thread
Back
Uniprogramming
Front
running one process at a time
Back
Thread States
Front
program counter
register values
execution stacks
Back
Lottery Scheduling
Front
not good for real time processes
Back
Amdahl's Law
Front
speedup <= 1/(1-P) + P/N
Back
Timesharing
Front
each user can afford to own terminals to interact with machines
Back
synchronization
Front
uses atomic operations to ensure cooperation among threads
Back
Operating System
Front
a virtual machine that hides the complexity and limitations of hardware from app programmers
Back
Thread
Front
sequential execution stream
Back
Atomic operation
Front
all or nothing, once executed it will run until complete or nothing at all
Back
Address space
Front
contains all states necessary to run a program
Back
Independent Threads
Front
- no states shared with others
- deterministic computation
- reproducible
- scheduling order does not matter
Back
System Call Sequence
Front
trap into kernel level
set kernel mode
branch table
trusted code
Back
Process creation
Front
fork()
0 = child
child pid = parent
-1 = failed
Back
Code verification
Front
test random leaving of locks and checking locks
Back
multiprocessing
Front
running programs on a machine with multiple processors
Back
Dispatching loop
Front
threads are run from them
per-CPU thread
contains context switch
run thread, save states, choose a new thread to run, load states from different thread
Back
Context Switch
Front
save states, choose a new thread to run, load states from a different thread
Back
2nd Phase of OS History
Front
Hardware cheap, humans expensive
hardware: terminals
Goal: efficient use of human resources
Back
mutliprogramming
Front
running multiple processes on a machine
Back
Busy waiting
Front
while a thread is waiting, it consumes CPU time
Back
1st Use of Semaphores
Front
Mutual exclusion
-semaphore has initial value of 1
-P( ) before critical section
-V( ) after critical section
Back
Drawbacks of Concurrency
Front
apps need protection from others
additional coordination
overhead to switch apps
potential worse performance when running too many apps
Back
Preemptive vs Non-Preemptive Scheduling
Front
Preemptive picks the best tasks to run even after starting (SJRF)
Nonpreemptive once it starts running it completes (SJF)
Back
Booting Sequence
Front
CPU jumps to ROM
Bios
runPOST
copy MBR
copy OS loader
copy kernel image
set to kernel mode
jump to OS entry point
Back
mutual exclusion
Front
ensures one thread can do something without the interference of other threads
Back
Race Condition
Front
the computing outcome dependent on the schedule of the execution
Back
Job
Front
unit of processing
Back
Batch System
Front
collects a batch of jobs before processing them and printing out results
Back
Section 2
(4 cards)
2nd Use of Semaphores
Front
Scheduling
-semaphore has initial value of 0
Back
Safety
Front
all processes are protected
achieve mutual exclusion
Back
Liveness
Front
no deadlock
no circular waiting
Back
Fairness
Front
no starvation
everyone that wants to execute can do so