Add support for delayed tasks in MemoryQueue

`MemoryQueue` now uses a `DelayedTaskIterator` wrapped in a `PeekIterator`. `DelayedTaskIterator` takes care of task ordering with respect to delayed tasks.