Re:Contexts, Threads, Capabilities and Interfaces
Posted: Thu Sep 15, 2005 10:02 am
Pype.Clicker, your analysis is artful!
The idea of thread-specific heaps sounds good, but requires a bit of extra work. In the standard model of things (as far as I'm aware) the heap is always mapped at the end of the data segment. However, mapping of things is handled at the context (room) level, and thus special locations would be needed for both stack and heap if both were to migrate.
I've actually banged out a pseudo-implementation of how this could all work. So far only the Permit() call is pseudocoded, but it's something to look at. It's attached and relies on the very basic capability unit I've written, which can't be attached right now.
That's the gist of it, really. MakeCapability() and CheckCapability() do exactly as they say, currently with a very basic encryption algorithm that I really, really hope can't be broken to easily. But that's for another post, and I've isolated the encryption work in those two functions anyway to make it easier to change. GetObjectID() increments a private global variable (implementation section of the Pascal unit, where other units that use this one can't see it) and returns its old value.
The idea of thread-specific heaps sounds good, but requires a bit of extra work. In the standard model of things (as far as I'm aware) the heap is always mapped at the end of the data segment. However, mapping of things is handled at the context (room) level, and thus special locations would be needed for both stack and heap if both were to migrate.
I've actually banged out a pseudo-implementation of how this could all work. So far only the Permit() call is pseudocoded, but it's something to look at. It's attached and relies on the very basic capability unit I've written, which can't be attached right now.
Code: Select all
type
TCapability = packed record
lwObjectID: longword;
wRights: word;
{This means the check value is a longword.}
CheckValue: array [0..9] of byte;
end;
PCapability = ^TCapability;
procedure MakeCapability(var Cap: TCapability; lwCheckValue: longword);
function CheckCapability(Cap: TCapability; lwCheckValue: longword): Boolean;
function GetObjectID(): longword;