Next: Segment fault handler
Up: Data Structures Used
Previous: The address space
Figure 3.7: The segment map after running the claim algorithm.
If one is to use virtual addresses for persistence, an
advantageous technique is
to reserve a range of virtual addresses that will constitute the persistent store.
There exists no explicit system call to do this under DPMI, but there does
exist a call to claim an individual segment selector.
The effect of claiming a range of segments can be had by the following algorithm.
Suppose we wish to claim 512 segments ( 32 megabytes) starting at segment
4000, then we:
- Call the allocate selector procedure 4512 times, recording in a bitmap
which selectors were allocated. Since some n selectors will already have been
reserved by other applications before our code starts this will have reserved all
segments up to 4511+n.
- Check that all segments between 4000 and 4511 have been reserved. If not
free all the claimed selectors and abort.
- Free all the segments that were claimed below 4000 and above 4511.
W Paul Cockshott
Fri Sep 6 10:29:18 BST 1996