1
CPSC 410--Richard Furuta 2/24/99 1
Silberschatz and Galvin Chapter 8
Memory Management
CPSC 410--Richard Furuta 2/24/99 2
Silberschatz and Galvin Chapter 8 Memory Management CPSC - - PDF document
Silberschatz and Galvin Chapter 8 Memory Management CPSC 410--Richard Furuta 2/24/99 1 Memory Management Goal: permit different processes to share memory--effectively keep several in memory at the same time Eventual meta-goal: users
CPSC 410--Richard Furuta 2/24/99 1
CPSC 410--Richard Furuta 2/24/99 2
CPSC 410--Richard Furuta 2/24/99 3
CPSC 410--Richard Furuta 2/24/99 4
CPSC 410--Richard Furuta 2/24/99 5
CPSC 410--Richard Furuta 2/24/99 6
CPSC 410--Richard Furuta 2/24/99 7
CPSC 410--Richard Furuta 2/24/99 8
Ð generates absolute code. Must know at compile time where the process (or object) will reside in memory. Example: *0 in C. Limits complexity of system.
Ð converts compilerÕs relocatable addresses into absolute addresses at load time. The most common case. The program cannot be moved during execution.
Ð process can be moved during its execution from one memory segment to another. Requires hardware assistance (discussed later). Run-time overhead results from movement of process.
CPSC 410--Richard Furuta 2/24/99 9
CPSC 410--Richard Furuta 2/24/99 10
CPSC 410--Richard Furuta 2/24/99 11
CPSC 410--Richard Furuta 2/24/99 12
¥ Also known as shared libraries ¥ Savings of overall memory (one copy of library routine) and of disk space (library routines are not in executable images). ¥ Expense: first use is more expensive ¥ Problem: incompatible versions Ð Can retain version number to distinguish incompatible versions of
routines. Ð If there are different versions, then you can have multiple versions
memory savings. ¥ Example: SUN OSÕs shared libraries
CPSC 410--Richard Furuta 2/24/99 13
CPSC 410--Richard Furuta 2/24/99 14
Common routines Overlay driver Main Routine A Main Routine B Overlay Area Common data
CPSC 410--Richard Furuta 2/24/99 15
CPSC 410--Richard Furuta 2/24/99 16
CPSC 410--Richard Furuta 2/24/99 17
CPSC 410--Richard Furuta 2/24/99 18
14000
logical address 346 physical address 14346
relocation register
CPSC 410--Richard Furuta 2/24/99 19
CPSC 410--Richard Furuta 2/24/99 20
CPSC 410--Richard Furuta 2/24/99 21
CPSC 410--Richard Furuta 2/24/99 22
CPSC 410--Richard Furuta 2/24/99 23
CPSC 410--Richard Furuta 2/24/99 24
CPSC 410--Richard Furuta 2/24/99 25
CPSC 410--Richard Furuta 2/24/99 26
CPSC 410--Richard Furuta 2/24/99 27
CPSC 410--Richard Furuta 2/24/99 28
CPSC 410--Richard Furuta 2/24/99 29
CPSC 410--Richard Furuta 2/24/99 30
CPSC 410--Richard Furuta 2/24/99 31
¥ Goal: allocate memory to multiple processes (which permits rapid switches, for example) ¥ Simple scheme: fixed-size partition Ð memory divided into several partitions of fixed size Ð each partition holds one process Ð partition becomes free when process terminates; another process picked from the ready queue gets the free partition Ð number of partitions bounds the degree of multiprogramming Ð originally used in the IBM OS/360 operating system (MFT) Ð No longer used
CPSC 410--Richard Furuta 2/24/99 32
Ð Hole: block of available memory Ð Holes of various size are scattered throughout memory
Ð Allocated partitions Ð Free partitions (hole)
CPSC 410--Richard Furuta 2/24/99 33
CPSC 410--Richard Furuta 2/24/99 34
CPSC 410--Richard Furuta 2/24/99 35
CPSC 410--Richard Furuta 2/24/99 36
CPSC 410--Richard Furuta 2/24/99 37
CPSC 410--Richard Furuta 2/24/99 38
CPSC 410--Richard Furuta 2/24/99 39
¥ General comments: Ð memory protection is necessary to prevent state interactions. This is effected by the limit register. Ð base registers are required to point to the current partition ¥ In general, blocks are allocated in some quantum (e.g., power or 2). No point in leaving space free if you canÕt address it or if it is too small to be of any use at all. Also there is an expense in keeping track of free space (free list; traversing list; etc.). ¥ This results in lost space--allocated but not required by process ¥ Internal fragmentation: difference between required memory and allocated memory. ¥ Internal fragmentation also results from estimation error and management overhead.
CPSC 410--Richard Furuta 2/24/99 40
CPSC 410--Richard Furuta 2/24/99 41
CPSC 410--Richard Furuta 2/24/99 42
CPSC 410--Richard Furuta 2/24/99 43
CPSC 410--Richard Furuta 2/24/99 44
CPSC 410--Richard Furuta 2/24/99 45
CPSC 410--Richard Furuta 2/24/99 46
CPSC 410--Richard Furuta 2/24/99 47
CPSC 410--Richard Furuta 2/24/99 48
CPSC 410--Richard Furuta 2/24/99 49
CPSC 410--Richard Furuta 2/24/99 50
CPSC 410--Richard Furuta 2/24/99 51
CPSC 410--Richard Furuta 2/24/99 52
CPSC 410--Richard Furuta 2/24/99 53
CPSC 410--Richard Furuta 2/24/99 54
CPSC 410--Richard Furuta 2/24/99 55
CPSC 410--Richard Furuta 2/24/99 56
CPSC 410--Richard Furuta 2/24/99 57
CPSC 410--Richard Furuta 2/24/99 58
20 bit page number and 12 bit page offset
CPSC 410--Richard Furuta 2/24/99 59
CPSC 410--Richard Furuta 2/24/99 60
CPSC 410--Richard Furuta 2/24/99 61
CPSC 410--Richard Furuta 2/24/99 62
CPSC 410--Richard Furuta 2/24/99 63
main program subroutines stack data
CPSC 410--Richard Furuta 2/24/99 64
CPSC 410--Richard Furuta 2/24/99 65
CPSC 410--Richard Furuta 2/24/99 66
CPSC 410--Richard Furuta 2/24/99 67
CPSC 410--Richard Furuta 2/24/99 68
CPSC 410--Richard Furuta 2/24/99 69
CPSC 410--Richard Furuta 2/24/99 70
CPSC 410--Richard Furuta 2/24/99 71
CPSC 410--Richard Furuta 2/24/99 72