Skip to content

Exams phase 5b: generated CPU-scheduling questions - #111

Open
A7med7x7 wants to merge 2 commits into
autopilot/exams-5a-generatedfrom
autopilot/exams-5b-scheduling
Open

A7med7x7 wants to merge 2 commits into
autopilot/exams-5a-generatedfrom
autopilot/exams-5b-scheduling

Conversation

@A7med7x7

Copy link
Copy Markdown
Member

Stacked on #109 (→ #108 → #105 → #104 → #102 → #101). Merge the exam stack in order.

Exam phase 5b: generated CPU-scheduling questions for Operating Systems, built on the same schedule() that powers the lessons' CPU scheduler. Each question draws 3 or 4 processes arriving at time 0, with distinct bursts from 1 to 12.

Generator Lesson / section Example (seed 12345)
FCFS average waiting CPU scheduling basics / FCFS bursts 4, 7, 3, 1 → 7.25, with options 11 (average turnaround), 3.25 (SJF's answer) and 29 (the sum)
SJF average waiting CPU scheduling basics / SJF bursts 7, 2, 9, 5 → 5.75, with options 8.5 (FCFS), 11.5 (turnaround) and 23 (the sum)
Round Robin finish time Round robin and beyond / Round Robin (RR) bursts 12, 7, 5, 11, q = 4 → P1 finishes at 32, with options 12 (its FCFS finish), 20 (its waiting time) and 36 (one quantum too many)
  • The Round Robin question always asks about a process longer than the quantum, so the quantum actually matters.
  • Each explanation shows the waiting times or the Gantt chart, then names the tempting wrong answers.
  • When the real-mistake distractors happen to coincide, for example when the listed order is already SJF order, the generator falls back to the right answer + 1 or + 2. That keeps four distinct options.

Tests

src/test/generated-questions.test.ts covers all generators: 500 seeds each, four distinct options, one right answer in every position, stable ids, and real lessons and headings. A new check recomputes all three scheduling answers with an independent simulation: running prefix sums for FCFS and SJF, and a plain queue for Round Robin.

npm run lint: 0 errors. npm run test: 3,699 passed. npm run build: OK.

Next

5c is Big-O for Algorithm Design and Analysis. That's your course, so I'll leave it until you say yes. Otherwise the next generated topics could be TCP congestion windows or Discrete Mathematics counting.


Generated by Claude Code

Three Operating Systems generators, built on the same schedule() the
lessons' CPU scheduler runs. Each draws 3 or 4 processes arriving at
time 0 with distinct bursts:
- average waiting time under FCFS,
- average waiting time under non-preemptive SJF,
- when a given process finishes under Round Robin with quantum 2 to 4
  (always one that gets preempted, so the quantum matters).

Wrong options are real slips: average turnaround instead of waiting,
the other algorithm's answer, the sum instead of the average, the FCFS
finish time, the waiting time. A test checks 500 seeds of each against
an independent simulation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EC6Zzt5akQu7TEHdGquZzp
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EC6Zzt5akQu7TEHdGquZzp

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants