Memory Management Strategies

Only available on StudyMode
  • Download(s) : 34
  • Published : April 23, 2013
Open Document
Text Preview
ITCS
 343
 
 Opera-ng
 System
 Principles
 
Memory
 Management
 Strategies
 

Virtualizing
 Resources
 
•  Physical
 Reality:
 
  Different
 Processes/Threads
 share
 the
 same
  hardware
 
–  Need
 to
 mul-plex
 CPU
 (Just
 finished:
 scheduling)
  –  Need
 to
 mul-plex
 use
 of
 Memory
 (Today)
  –  Need
 to
 mul-plex
 disk
 and
 devices
 (later
 in
 term)
  –  The
 complete
 working
 state
 of
 a
 process
 and/or
 kernel
 is
  defined
 by
 its
 data
 in
 memory
 (and
 registers)
  –  Consequently,
 cannot
 just
 let
 different
 threads
 of
 control
  use
 the
 same
 memory
  –  Probably
 don’t
 want
 different
 threads
 to
 even
 have
  access
 to
 each
 other’s
 memory
 (protec-on)
 
•  Physics:
 two
 different
 pieces
 of
 data
 cannot
 occupy
 the
 same
  loca-ons
 in
 memory
 

•  Why
 worry
 about
 memory
 sharing?
 

Memory
 Hierarchy
 of
 a
 Modern
 Computer
 System
  •  Take
 advantage
 of
 the
 principle
 of
 locality
 to:
 
–  Present
 as
 much
 memory
 as
 in
 the
 cheapest
 technology
  –  Provide
 access
 at
 speed
 offered
 by
 the
 fastest
  technology
 
Processor Control Second Level Cache (SRAM) Main Memory (DRAM) Secondary Storage (Disk)

Tertiary Storage (Tape)

On-Chip Cache

Registers
1s
  100s
 

Datapath

Speed
 (ns):
  Size
 (bytes):
 

10s-­‐100s
  Ks-­‐Ms
 

100s
  Ms
 

10,000,000s
 
 
  10,000,000,000s
 
 
 
 
 
 (10s
 ms)
 
 
 
 (10s
 sec)
  Gs
  Ts
 

Background
 
•  Program
 must
 be
 brought
 (from
 disk)
 
 into
 memory
 and
 placed
 within
  a
 process
 for
 it
 to
 be
 run
  •  CPU
 can
 access
 directly
 to
 registers
 and
 main
 memory
  –  Register
 access
 in
 one
 CPU
 clock
 (or
 less)
  –  Main
 memory
 can
 take
 many
 cycles
  •  Cache
 sits
 between
 main
 memory
 and
 CPU
 registers
 -­‐
 to
 reduce
 CPU
  idle
 .me
 and
 make
 the
 available
 data
 faster
 to
 access.
  •  Protec-on
 of
 memory
 ensures
 correct
 opera-on
  –  to
 protect
 the
 opera.ng
 system
 from
 access
 by
 user
 processes
  and,
 
  –  to
 protect
 user
 processes
 from
 one
 another.
  –  One
 simple
 implementa.on
 is
 through
 base
 and
 limit
 registers
 

Mul--­‐step
 Processing
 of
 a
 Program
 for
 Execu-on
 
•  Prepara-on
 of
 a
 program
 for
  execu-on
 involves
 components
  at:
 

•  Addresses
 can
 be
 bound
 to
 final
  values
 anywhere
 in
 this
 path
  •  Dynamic
 Libraries
 

–  Compile
 -me
 (i.e.
 “gcc”)
  –  Link/Load
 -me
 (unix
 “ld”
 does
 link)
  –  Execu-on
 -me
 (e.g.
 dynamic
 libs)
  –  Depends
tracking img