initiate-send-resource(r)
if type(r) = memory
then update local memory map
send-request-response (r, owner(r), false)
return
==========================
on-resource-transferred (r,n)
==========================
/* When an acknowledgement comes in that the transfer is complete */
r.owner = n
r.transferring = false
return
==========================
on-receive-resource(r,n)
==========================
/* Now we receive a message with the requested resource r from n*/
r.k = 0
r.wanted = false/* clear the bit saying that it's wanted */
r.owner = me /* set the owner to n (i.e., “me”) */
if the resource is memory,
update the memory map with the new memory