76 Segment Utilisation Table (SUT)

The SUT will no longer store an LSS&.

The SUT does not publish MVCC snapshots. Readers do not access the SUT, so it is mutable state protected by the Partition mutex.

Platform-independent SUT sections

A large SUT can store each SUT section in a whole segment. The segment is dedicated to the SUT section and is interpreted as an indexed array of serialised 32-bit utilisation values. The stored bytes must not be accessed by casting the segment buffer to a native int32*, because that would make the representation depend on the platform's byte order.

GetUtilisation_X() calculates the address of the indexed 32-bit value and uses an InputArchive over those four bytes to deserialise the value:


int32 SUTSection::GetUtilisation_X(uint32 index) const
{
    cxAssert(index < numEntries_);

    const std::size_t offset = index * sizeof(int32);
    InputArchive ar(std::span<const octet_t>(buffer_ + offset, sizeof(int32)));

    int32 utilisation;
    Deserialise(ar, utilisation);
    return utilisation;
}

SetUtilisation_X() calculates the same address and uses an OutputArchive to serialise the new value into those four bytes:


void SUTSection::SetUtilisation_X(uint32 index, int32 utilisation)
{
    cxAssert(index < numEntries_);
    cxAssert(utilisation >= 0);

    const std::size_t offset = index * sizeof(int32);
    OutputArchive ar(std::span<octet_t>(buffer_ + offset, sizeof(int32)));
    Serialise(ar, utilisation);
    isDirty_ = true;
}

The archive operations use the byte order defined by cxSerialise, so the SUT section can be written on a little-endian machine and read on a big-endian machine, or vice versa.