A fully vibecoded OS
  • C 93.8%
  • Assembly 2.3%
  • Makefile 2%
  • Shell 1.3%
  • Python 0.4%
  • Other 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Kevin Alavik 63d115b4fb smptest: do CPU-bound processes really run at the same time?
"SMP works" is easy to claim and easy to get wrong, because a scheduler
that round-robins one task to completion before starting the next behaves
identically from the outside: every program runs, every program finishes,
and nothing notices that four processors spent the run taking turns.

So this does not check that the children finish. It checks two things a
serial scheduler cannot fake.

**They were on more than one processor.** Each child asks the kernel which
processor it is on, and the kernel answers from the APIC's own
identification register rather than from the scheduler's bookkeeping --
so "the scheduler spread them out" and "the hardware ran them at once" are
checked against different sources, and a scheduler that believed it had
migrated a task would be caught. That needed a `getcpu` syscall, which
there was no way to ask for before; it is 75, which Linux also leaves open
there.

**Their lifetimes overlapped.** Every child records the millisecond clock on
entry and on exit, and the check is that the *latest* start is before the
*earliest* end. In sequence the last child starts after the first has
finished, and this fails however many processors there are.

The work is a sieve because it has an unpredictable memory access pattern
and enough of one to keep a processor busy, and its answer is checked from
every child, so a child that returned the right number without computing it
cannot pass. Repeated 24 times because the finest clock here is a
millisecond: one sieve finishes inside one, which is indistinguishable from
having run in sequence.

Both checks are conditional on there being more than one processor. A
one-processor machine cannot fail either, and a test that reports a failure
for a correct single-processor run is a test about the machine.

Four bugs the first run found in itself, which is the argument for writing
it: it counted "processor" as a substring and reported five CPUs on a
four-CPU machine, because `model name: minx virtual processor` contains the
word; it compared `wait()`'s returns against the fork order, which fails
for every child after the first on any machine where they finish in a
different order; it passed `minx_report()`'s return value as the exit
status, which is a character count; and it passed the failure *count* where
the API wants "did it pass".

Four children, four distinct processors, `phase11-smp` green.

Co-authored-by: Space Bunny Free <[email protected]>
2026-10-14 18:00:31 +02:00
.githooks docs: add agent instructions and OS spec 2026-10-03 10:14:13 +02:00
boot build: add pinned asset fetching, Limine ISO build and QEMU harness 2026-10-03 13:42:08 +02:00
docs smptest: do CPU-bound processes really run at the same time? 2026-10-14 18:00:31 +02:00
kernel smptest: do CPU-bound processes really run at the same time? 2026-10-14 18:00:31 +02:00
libc libc: the environment was looked for one word past a static array 2026-10-14 17:39:13 +02:00
tools mm: the heap's redzone check was reading the wrong address 2026-10-14 16:02:07 +02:00
user smptest: do CPU-bound processes really run at the same time? 2026-10-14 18:00:31 +02:00
.gitignore acpi, interrupts, timers and the PS/2 keyboard 2026-10-03 16:49:11 +02:00
AGENTS.md docs: record the host toolchain preference in AGENTS.md 2026-10-03 21:02:10 +02:00
CLAUDE.md docs: add agent instructions and OS spec 2026-10-03 10:14:13 +02:00
knowledge.md docs: add agent instructions and OS spec 2026-10-03 10:14:13 +02:00
Makefile build: make test-host now runs, and the allocator bug it finds 2026-10-14 15:55:38 +02:00
PROMPT.md docs: add agent instructions and OS spec 2026-10-03 10:14:13 +02:00
README.md init 2026-10-01 18:37:25 +02:00
UNLICENSE correct license file naming 2026-10-01 18:58:44 +02:00

minx - A fully vibecoded OS

This is an experimental OS that is 100% AI generated, i only prompt different models. (the model is noted in the commits).

Why?

I want to see how far AI has come and how useful it can be, i take 0 credit for this and the project is under the UNLICENSE license (public domain). Feel free to use any piece off code, but keep in mind all the code is 100% AI generated.