lecture11

lecture11 - Memory Allocation and Virtual Memory The...

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

View Full Document Right Arrow Icon
Memory Allocation and Virtual Memory The simplest memory allocation is to have sev eral fixed memory partitions and allocate a process to each one. Different sized partitions can be allocated to accomodate different processes memory needs. Unless the workload is very well understood, fixed pertitions are seldom used. There is generally wasted space. Variable partitions are more common. Variable Partitions Note that algorithms for variable partition allocation are also effective for non-OS allocators. Even systems that use other allocation systems in the OS may use variable size allocators inside processes. (An example is the malloc library call.) A A B A B C B C D B C D C Variable partitions change the wasted space problem. Rather than picking one set of partition sizes and hoping that processes use them wisely ,wehav e to solvethe problem of allocating memory well. The goal is to avoid compaction, the wholesale reorganization of memory. At this point we introduce the idea of swapping. Swapping is moving a running process from mem- ory to secondary storage to allowanother higher process to use its space. Systems may swap processes for avariety of reasons, from higher priority processes becoming available, to making system-wide usage deci- sions. For example, large batch jobs may run freely when the system is under-utilized, but be swapped out when a lot of interactive jobs are being submitted. Both fixed and variable partition systems (and paged VM or segmentation systems) can swap. The same variable memory allocation algorithms we discuss here can be used to allocate swap space.
Background image of page 1

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

View Full DocumentRight Arrow Icon
-2- Data Structures Free memory has to be tracked to be allocated to processes. We can keep track of either holes (unal- located regions of memory) or allocations. Whatevermemory isn’ tinone set is in the other .Some portion of memory is set aside as allocable to processes, and data structures in the address space permanently allo- cated to the OS are used to keep track of it. used: Bitmaps One way to keep track of allocable memory is to divide it into fixed size allocation units and use a bitmap to keep track of the allocated and unallocated areas. This can be slowtosearch for the next hole - bit operations are slow. This is still sometimes used (nachos uses this to track the used physical memory).
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/28/2008 for the course CS 402 taught by Professor Tedfaber during the Spring '05 term at USC.

Page1 / 5

lecture11 - Memory Allocation and Virtual Memory The...

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

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