#include "../sched.hpp" /// Each task is run for a time quantum or the remainder of its cpu burst Task * RoundRobinQueue::next(int slice) { if (head == nullptr) return nullptr; if (head->node->burst <= 0) { delete head->node; remove(head->node); return next(slice); } auto *it = head; it->node->burst -= slice; if (head->next) head = head->next; it->next = nullptr; tail->next = it; tail = it; return it->node; }