Repository navigation
BooleOS 0.22.1 - Patch: console output race fixed
BooleOS 0.22.1 - Phase 22: unlink()/rmdir() (patch: console output race fixed)
Don't want to compile? Download booleos-0.22.1.zip: it has the bootable ISO, a blank disk image and a README.txt. All you need is QEMU; the exact command is in README.txt.
Changes
Fixed
- Console output race, found while validating Phase 22. Typing at the shell while a background
runprogram kept printing corrupted the screen: characters lost or doubled, a command's name scrambled, and in the worst case what looked like a command running again by itself.- Cause:
vga_putchar(),vga_clear()andvga_set_cursor()inkernel/drivers/vga.cread and wroteterm_col,term_rowand the VGA buffer with nothing stopping a preemption. Any process reaches them throughSYS_WRITE(the shell's key echo included),SYS_CLEARandSYS_GOTOXY. A timer tick landing mid-write left that shared state half-updated for whichever process ran next. A tick inside the roughly 2000-cell copy loop ofvga_scroll()could tear a whole scroll, duplicating or dropping a line; that was the "command ran again by itself" symptom. - The shell's line buffer and the keyboard ring buffer were checked and are not involved: the first is private to each process and the second has one producer and one consumer.
- Fix: the whole body of each of the three functions now runs between
irq_save()andirq_restore(), the same patternfat16.cuses. That is safe here because nothing invga.cwaits on an IRQ, unlike disk I/O. - Not changed: two processes that print at the same time still interleave their output line by line, and the echo of what you type mixes with another process's output. That is how a shared terminal behaves. The FAT16 buffers held across blocking disk writes (lock planned for Phase 29) are a separate problem and were not touched.
- Cause:
Added
- selftest test 32 (32 tests in total, was 31): four children and the parent each write about 4000 bytes at once, which forces the race above. No syscall reads the screen back, so the test checks what it can: every child is reaped and an unrelated syscall still behaves normally afterwards.
- A manual test in
docs/testing.md: type a command whilerun selftestis still printing and check by eye that no line is duplicated or lost and no command runs twice.
Changed
kernel/version.hbumped to0.22.1(PATCH: no new phase,BOOLEOS_PHASEstays22); the README banner follows.docs/hal.mdandPROGRESS.mddescribe the interrupt-off section invga.c; the known issue about typing while a program prints is gone fromdocs/TODO.md.
Full history: CHANGELOG.md