Build Open Agila OS · 2 · 3 Lessons
English

Build Open Agila OS

Module 2 – Build Open Agila OS · 2

Page 1 of 3 · About 15 minutes per lesson, including practice.

A scheduler with observable order

15-minute session: read for 3 minutes, trace for 3, experiment for 7, and complete the check for 2. Spend longer whenever you need.

A scheduler chooses which runnable task receives a turn. Model round-robin with a queue. Each task consumes one unit before returning to the queue if work remains. This deterministic model omits interrupts, context switching, and true parallel execution.

Practice and evidence: Trace A=2 and B=1, then add an empty task and document whether it should enter the runnable queue. Test fairness by checking the execution order.

from collections import deque
ready=deque([("A",2),("B",1)])
order=[]
while ready:
    name,left=ready.popleft()
    order.append(name)
    if left>1: ready.append((name,left-1))
print(" ".join(order))

Expected result: A B A

Practice and evidence

Keep three notes: your prediction, the actual result, and why they match or differ. The completion check grades understanding; the practice task builds skill.

Language reference: git.agilaos.com

Language reference: git.agilaos.com

Example code on Agila Forge ↗

Complete this lesson

Answer every check correctly to earn your lesson certificate. Feedback helps you review and try again.

Sign in · Save your progress and earn a certificate for this lesson.