I thought the exchange heap was very neat, but I was wondering how a particular buffer can be marked to be within the exchange heap. Is there a particular method for marking buffers to be used within a channel? There was a description of the contract
that is used to communicate across a channel with specific message formats. I was wondering if in the next video someone could address how the exchange heap and channels interract with two communicating processes. More specifically, is there anything special
that needs to be done from a programming stand point or is it all taken care of in the message sending code?
Since data in the exchange heap is completely separate from GC data and has different types, it is also allocated with a variation:
byte in ExHeap buf = new[ExHeap] byte;
would allocate a 512 byte buffer in the ExHeap. Given a message
message Data(byte in ExHeap buf);
and a channel endpoint e supporting this message, you would use
to transfer the buffer. Note that buffers are not associated with a particular channel. e.g., the receiver of the Data message above can turn around and send the buffer to whoever it wants to; or alternatively, it could free the buffer explicitly via:
The type system/static analysis makes sure that programs don't touch data in the ExHeap they don't own (e.g., after send or delete).