Each task has an enqueue time and processing duration. A single CPU runs one ready task at a time. When idle, it selects the available task with the shortest processing time; ties go to the smaller original index. Tasks arriving while the CPU is busy wait in the ready queue.
Sort tasks by enqueue time and maintain a min-heap ordered by (duration, originalIndex). If the heap is empty, advance the simulated clock to the next task arrival. Otherwise pop one ready task, advance by its duration, and add every task that arrived by the new time.
Use a 64-bit or otherwise sufficiently wide clock so accumulated durations cannot overflow. Trace a case where the CPU becomes idle between arrivals and one where several tasks arrive during one execution. The problem is a scheduling simulation, not a complete model of a real kernel scheduler.