
CS 414 : Operating Systems
UNIVERSITY OF VIRGINIA
Department of Computer Science
Fall 2005
Topic 11: Dynamic Storage Allocation
๎
Two aspects of memory allocation:
๎
Static allocation: finding a slot in memory big enough to load a.out
๎
Dynamic allocation: while executing the program, finding space for additional memory
requests
๎
Why isnโt static allocation sufficient for everything?
๎
Recursive procedures: e.g., factorial
๎
Complex data structures: e.g., symbol table
๎
What is the probelm if all storage must be reserved in advance (statically)?
๎
OS cannot predict when a process will come and ask for storage space: Need dynamic memory
allocation both for main memory and for file space on disk.
๎
Two basic operations in dynamic storage management:
๎
Allocate
๎
Free
๎
In general, dynamic allocation can be handled in one of two general ways:
๎
Stack allocation (hierarchical; LIFO): restricted but simple and efficient.
๎
Heap allocation: more general, but less efficient, more difficult to implement.
๎
Stack organization: memory allocation and freeing are partially predictable (we do better
when we can predict the future).
โ 11.1 โ