Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Virtual_memory Class Reference

Virtual_memory is the allocator/deallocator for virtual memory. More...

#include <virtmem.h>

Collaboration diagram for Virtual_memory:

Collaboration graph
[legend]
List of all members.

Public Methods

void init ()
void * alloc (unsigned int request_size)
void free (void *data_address)

Public Attributes

void * managed_mem_start

Protected Attributes

Chunkcurr_free_chunk
Chunkfree_list_head
Chunkfree_list_tail

Detailed Description

Virtual_memory is the allocator/deallocator for virtual memory.

Some ideas are borrowed from malloc_chunk in Doug Lea's malloc implementation, but significiant design differences are necessary due to the persistent nature of the virtual memory space. (You can't just go around accessing swapped-out pages left and right. Well, you can, but it'd be really slow.)


Member Function Documentation

void * Virtual_memory::alloc unsigned int    request_size
 

Allocate some virtual memory of the given size in bytes and return it.

void Virtual_memory::free void *    data_address
 

Free some virtual memory previously allocated by alloc().

void Virtual_memory::init  
 

Initialize the free list of virtual memory.


Member Data Documentation

Chunk* Virtual_memory::curr_free_chunk [protected]
 

current chunk of free list.

Chunk* Virtual_memory::free_list_head [protected]
 

points to first chunk in free list.

Chunk* Virtual_memory::free_list_tail [protected]
 

points to last chunk in free list.

void* Virtual_memory::managed_mem_start
 

start of managed memory chunks.


The documentation for this class was generated from the following files:

Torsion Operating System, Copyright (C) 2000-2002 Dan Helfman