ChronOS Memory Management: Unterschied zwischen den Versionen
Mat (Diskussion | Beiträge) (Created page with "== Segments == The remaining free memory (starting at the end of the global variables and ending at Bascom's Frame start) is managed by the OS using segments. A segment is a line...") |
(kein Unterschied)
|
Version vom 3. Mai 2011, 22:39 Uhr
Segments
The remaining free memory (starting at the end of the global variables and ending at Bascom's Frame start) is managed by the OS using segments. A segment is a linear block of memory of any size fitting the available memory. They can be created and killed during runtime. On creation, the memory manager searches a free block big enough to hold the new segment.
Because this happens in a random order, external fragmentation could occur. This means, that there are small blocks of free memory between the segments, not big enough to hold new segments. In the end, a new segment cannot be created, although the free memory in addition is big enough. To avoid this, the memory manager cleans up the memory by moving all segments together. Addresses, which are pointing in a moved segment, become invalid. To take care of this, each pointer has to be registered in the OS and will then be adjusted if a segment is moved. However, this cannot be done with the task segments, because the pointers in the stacks are not registered. So these segments are static and are not moveable.
Pipes
Pipes are simple LIFO buffers, so data will be written on the top of the stack and read from the bottom. They are available for byte and word values. Each pipe is stored in an own segment. If you store a pointer in the pipe, it has to be registered.