Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
SysStorage


NAME

SysStorage - storage allocator with copying garbage collector

DESCRIPTION

SysStorage is a possible implementation of the interface of Storage.

Additionally, this version also implements the UntaggedStorage interface.

The current implementation utilizes SysMemory.Map which allows to allocate memory at arbitrary memory locations and Memory which manages the address space. During startup, SysStorage initializes Memory and calls Memory.SetPageSize. Further, SysStorage examines the segments of SysSegments and registers them by calling Memory.ReserveRegion.

SysStorage supports growing stacks and redzone protections. For this to work, it defines a handler for SysSignals.SIGSEGV which checks all memory access faults for being stack extensions. The event component fixed will be set to TRUE if the address which caused the failure will be valid afterwards.

A copying garbage collector is available. During a garbage collection, all global data and coroutine stacks are scanned for pointers refering to dynamic storage objects. All objects within reach are copied into a new memory location and the corresponding pointer values are corrected.

When very large objects are requested (e.g. object size greater than the system's page size), SysStorage checks if it is advantageous to treat them in a special way which makes it possible that such objects need not be copied by the garbage collector and the amount of memory needed for running a garbage collection is reduced.

For best address space utilization in case of large objects, it is recommended to request sizes which are (nearly) a power of 2.

After a garbage collection, the old memory regions are deallocated using Memory.ReleaseRegion and SysMemory.Unmap. SysStorage also looks for coroutines which can not be activated and is responsible for the deallocation of their stacks. In that case, SysInterrupts.interrupts is updated.

DIAGNOSTICS

SysStorage raises Storage.outOfMemory short before running out of memory.

Process.endOfGarbageCollection is guaranteed to be raised, if Process.startOfGarbageCollection has been before, but it may occur that Process.startOfGarbageCollection is raised and and no garbage collection can be performed. This happens when SysInterrupts.interrupts is not 0, or if there is not enough storage left to run a collection. A garbage collection is also rejected, if the current priority is higher than Priorities.storage (Process.startOfGarbageCollection is not raised).

This implementation does not use Coroutines.tag to identify coroutines.

SEE ALSO

Coroutines
exports Coroutines.tag which marks coroutines
Memory
address space management
Priorities
event priority system
Storage
storage allocating interface for the compiler
SysInterrupts
bookkeeping about interrupted coroutines
SysMemory
Oberon interface to mmap(2) related calls
SysSegments
list of reserved memory regions
SysSignals
event manager of SysSignals.SIGSEGV
UntaggedStorage
interface for storage not affected by garbage collection

Andreas Borchert, Report of Ulm's Oberon Compiler, University of Ulm, SAI

FILES

/dev/zero
is used as memory object for SysMemory.Map. SysStorage fails completely if this file cannot be opened.

ADAPTATION

Hansjörg Nägele, University of Ulm
Edited by: borchert, last change: 1995/11/09, revision: 1.6, converted to HTML: 1997/04/28

Oberon || Library || Module Index || Search Engine || Definition || Module