v8stanford.edu-Dynamic_Storage_Management

v8stanford.edu-Dynamic_Storage_Management - Dynamic Storage...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
http://w w w .stanford.edu/~ouster/cgi-bin/cs140-w inter12/lecture.php?topic=storageAlloc January 11, 2012 Dynamic Storage Management Dynamic Storage Management Lecture Notes for CS 140 Winter 2012 John Ousterhout Readings for this topic from Operating System Concepts : none. Static memory allocation is simple and convenient, but it's not sufficient for everything. Two basic operations in dynamic storage management: Allocate a given number of bytes Free a previously allocated block Two general approaches to dynamic storage allocation: Stack allocation (hierarchical): restricted, but simple and efficient. Heap allocation: more general, but less efficient, more difficult to implement. Stack Allocation A stack can be used when memory allocation and freeing are partially predictable: memory is freed in opposite order from allocation. If alloc(A) then alloc(B) then alloc(C), then it will be free(C) then free(B) then free(A). Example: procedure call. X calls Y calls Y again. Stacks are also useful for lots of other things: tree traversal, expression evaluation, top-down recursive descent parsers, etc. A stack-based organization keeps all the free space together in one place.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/02/2012 for the course CS 140 taught by Professor Rosenblum during the Winter '08 term at Stanford.

Page1 / 3

v8stanford.edu-Dynamic_Storage_Management - Dynamic Storage...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online