Exercise in concurrent algorithm design