mirror of
https://github.com/Leonmmcoset/cleonos.git
synced 2026-04-21 10:40:00 +00:00
1.8 KiB
1.8 KiB
Stage 29 - Async Exec Dispatch + TTY-Bound Input Ownership
Goal
- Make process launch lifecycle explicit (
pending -> running -> exited) and tick-driven. - Bind user input to the process TTY context to avoid cross-TTY input stealing.
- Keep kernel shell input compatibility while preparing cleaner multi-TTY user-shell behavior.
Implementation
- Exec lifecycle (Stage 29A):
- Added process states:
CLKS_EXEC_PROC_PENDING,CLKS_EXEC_PROC_RUNNING,CLKS_EXEC_PROC_EXITED. clks_exec_spawn_path()now queues process records as pending.- Added
clks_exec_tick()to dispatch pending processes from scheduler tick context. waitpidnow understands pending/running/exited transitions.
- Added process states:
- TTY ownership (Stage 29B):
- Added
tty_indexto exec process record and capture active TTY when process is created. - Added
clks_exec_current_tty()to resolve the current execution TTY safely. - Refactored keyboard input buffer to per-TTY ring queues.
- Added
clks_keyboard_pop_char_for_tty()API. - Updated syscall keyboard read path to pop from
clks_exec_current_tty()queue.
- Added
Acceptance Criteria
spawnno longer blocks immediate caller flow and enters pending lifecycle.- Tick loop dispatches pending processes without recursive launch storm.
- Keyboard input on one TTY is not consumed by process context on another TTY.
- Kernel shell input remains functional through existing
clks_keyboard_pop_char()API.
Build Targets
make userappsmake ramdiskmake isomake run
QEMU Command
make run
Debug Notes
- If user shell appears to miss input, log
clks_exec_current_tty()and active TTY during syscallKBD_GET_CHAR. - If input is delayed, inspect queue depth via
kbdstatand verify per-TTY counters move. - If
waitpidstalls forever, check whetherclks_exec_tick()is called in scheduler/user service tick.