Moved logic from queues to locked shared memory

The queues approach had a problem. Say the consumer is not
used to fetch messages for a while. In this while the allocation
has changed multiple times. When the next invocation of the consumer
happens, the oldest message is fetched from the queue. It will take
a while before the consumer catches up

The approach has been simplified with a shared memory protected by a
lock and notified using an event