The addressing system basically implements a data structure where addressing entries containing (agent specifiers, address) pairs can be stored. The address can be one of
The entries also contain per agent message queues.
The addressing system uses hash table for storing these entries. To ensure effiencient action, hashing is done both ways.
An ActorSpecifier is defined as a 256-bit or 32 char long char array.
A SchedulerID is the local address. It is defined in Scheduler definition.
A RemoteAddress is a struct that includes DomainAddress and an ActorSpecifier valid in that domain. The DomainAddress is specified in Networking Implementation.
An Address consists of an union that can be one of local address (SchedulerID), RemoteAddress, special agent address or external agent address. The latter two are unsigned long integers indices to data structures holding those agents. For the external agents the data structure is the external agent system.
The Address struct also contains enum type that implies the valid field of the union.
An ActorEntry consists of an ActorSpecifier, which is the (unique) key of the data structure, Address that to specifier maps to, the messaging queue, and a bit that indicates whether the agent is blocking (not able to to receive messages).
The AddressingSystem contains an array of null-terminated linked-lists of ActorEntries. The array index is got by counting a hash value from the agent specifier; the hash value can be calculated by simply taking the last n bits of the identifier, since the identifier is supposed to be random. This means that the size of the hash array has to be a power of two, which is reasonable also for performamce reasons (there is no point in extending or shrinking the array by a constant value.)
The entries are also indexed backwards using the address as the hash key. This makes it possible to perform effiecient queries by the address.
In addition to the interface functions defined in Addressing module specification, the addressing system
Description: | Prints the address address to str in readable - that is in hexadecimal - format. |
Description: |
Description: | Prints the contents of the entry to STDIN. Returns ADDR_OK, if the entry is not invalid. |
Description: |
Description: |
Description: | Frees the memory used by the entry. The entry definetely will be invalid after calling this. |
Description: | Counts a hash value from an arbitrary long item. Uses very simple and thereby propably non-optimal algorithm. The hash value is returned as the return value. The size argument specifies the length of the item. The hash value will be moduloed between 0 and maxvalue. |
Description: | Dumps len characters from source to dest in hexadecimal format. |
Description: |
Description: | Reads an entry from the disk. Returns ADDR_OK on success, ADDR_INTERNAL or ADDR_INVALIDARG otherwise (eg. fd bad etc.) |
Description: | Either doubles or halves the size of the address hash table. If the enlarge argument is ADDR_ENLARGE, enlargement is done, halving takes place otherwise. The table will be reallocated and all entries rehashed. Return ADDR_OK on success. |
Description: | Counts a hash value from a ActorSpecifier. The value is counted simply by anding the first bytes of the specifier, since the ActorSpecifier should adequetely random. The hash value is returned as the return value. The function uses the addresssystem.hashmask as the mask for anding the hash value. |
Description: | Prints the actor specifier spec to str in readable - that is in hexadecimal - format. |
Description: | Writes an entry to disk. Returns ADDR_OK on success, ADDR_INTERNAL or ADDR_INVALIDARG otherwise (eg. fd bad etc.) |