Save
OS Final
Save
Share
Learn
Content
Leaderboard
Learn
Created by
kenna duesing
Visit profile
Cards (61)
Process


Any
program
in execution
Context switch in OS
1. OS
saves
current context of running process A on
kernel
stack
2. Switch
stack
pointer
to kernel stack of B
3.
Restore
context from B's kernel stack
Memory address translations
The MMU translates
virtual
memory addresses to
physical
memory addresses
TLB (Translation Lookaside Buffer)
Stores
recent
translations
of
virtual
memory to
physical
memory, which
speeds
up the
translation
process in the
MMU
Paging
Manages
memory
more
efficiently
Eliminates
external
fragmentation
External fragmentation
Unused
memory
blocks left behind when a
process
is
removed
Thread
A
segment
of a
process
that executes independently
Share
the
same
address space
Has
separate
PC
and
stack
CPU
central processing unit
Memory Heirarchy
higher =
small
,
fast
,
more
expensive,
lower
latency
lower =
large
,
slow
,
less
expensive,
higher
latency
Processes have
three
segments

text
,
data
, and
stack
Caches
hold
recently
accessed
data or instructions
~
100
cycles
Virtual memory
allows users to run programs without
loading
the entire program in memory at
once
pieces
of the program are loaded as
needed
OS
timeshares
CPU across
multiple
processes
Static
code
and
data
Dynamic
stack
and
heap
How OS creates a process
allocates
memory
and creates memory
image
loads
code
,
data
from disk
creates runtime
stack
,
heap
Running
currently
executing
on
CPU
Ready
waiting
to be
scheduled
Blocked
suspended
,
not
ready to
run
New
being
created
, yet to
run
Dead
terminated
Process Control Block
where
information
about each
process
is
stored
API
application programming
interface
functions available to
write
user
programs
set of
system calls
fork()
creates a new
child
process by making a
copy
of
parent's
memory image
all processes are
created
by forking from a
parent
parent
and
child
execute and modify the memory data
independently
on success, the
PID
of the child process is
returned
in the
parent
0
is returned in the child
on failure,
-1
is returned in the
parent
, no
child
process
is created
wait()
causes a
parent
to
block
until
child
terminates
Optimization


Utilization
,
turnaround
time,
response
time,
fairness
, and
overhead
FIFO


high
turnaround
time
first few accesses are
cold
misses
SJF


provably
optimal
when all processes arrive together
non-preemptive
SJTCF
or
SRTF


preemptive
RR


every process executes for a
fixed
quantum slice
preemptive
good for
response
time and
fairness
bad
turnaround
time
Paging


OS divides
virtual
address space into
fixed
size pages
Goals of memory virtualization
transparency
,
efficiency
,
isolation
and
protection
Static
/
global variables
are allocated in the executable
TLB miss
MMU has to
walk
the page table, very
expensive
Given a 64 bit system where each page size is 4KB, calculate the number of page table entries required for each process
2^64/2^12 = 2^52
External fragmentation
variable-sized
unites
free
space
between
data
Ex.
segmentation
Solution -
compaction
or
paging
Internal
fragmentation
fixed-size
variables
space
left
because the
whole
page wasn't used
Ex.
paging
Page fault
when translating
VA
to
PA
, MMU reads present bit. If bit
isn't
in memory, MMU raises a
trap
to the OS.
Swap space
pages
that are not in
active
use
pages that are
evicted
from
memory
LRU


works well due to
locality
of
references
See all 61 cards