Practice · 2 of 4
Bounded FIFO Queue
CHALLENGE
Difficulty: advanced+25 XP
Given: mutex, condvar, int slots[8], head/tail/count. Implement int qpush(int v) (append FIFO; -1 when full) and int qpop(void) (remove oldest; -1 when empty). Push/pop must maintain the mutex and the invariant count equals live elements.
Press Submit to check your solution.
Back to lesson: Practice: Synchronization Drills