feature: preemptive process management - implementation progress
Implement a preemptive multitasking system for the Asuro kernel. Context Switching & Scheduling: - Custom IRQ0 ISR (contextswitcher.pas) with PUSHAD/POPAD ESP-swap - Round-robin scheduler with priority-based quantum - Process table using DList of PProcessContext pointers - Idle process (PID 0) replaces kernel HLT loop Process Lifecycle: - create/kill/terminate/sendMessage API (processmanager.pas) - Process states: Created, Running, Ready, Suspended, Awaiting, Finished, Error - Parent-child tracking (ParentID, smChildExited notification on reap) - proc_yield, proc_sleep_ms, proc_await, proc_suspend, proc_exit Resource Binding & Cleanup: - Per-process resource list (bindResource/unbindResource/unbindAllResources) - TCP sockets auto-bound to owning process (OwnerPID on TTCPSocket) - socket_cleanup + auto-unbind in DestroySocket VTerminal Refactor: - Multi-instance design (heap-allocated TVTermState per terminal) - Foreground process with incremental stdout/stderr drain via LVGL timer - Ctrl+C kills foreground process (killForeground) - Per-terminal CWD, dir stack, FS builtins (CD/LS/PUSHD/POPD) - Background job support (& suffix, JOBS/FG commands) - Command history (Up/Down arrow) Command Consolidation: - 14 commands extracted from 9 units into centralized progmanager.pas - Command procedures exported in host unit interfaces - E1000/TRACER/stdio builtins kept in-place (conditional/circular) New Units: - src/include/proctypes.pas — process type definitions - src/processmanager.pas — core process manager - src/prog/ping.pas — standalone ICMP ping process - src/prog/testcmd.pas — test command (proc_sleep_ms demo) - src/testprocs.pas — process subsystem smoke tests Misc: - ICMP callbacks gain userData parameter for concurrency-safe ping - CLI/STI guards on kalloc/kfree (lmemorymanager.pas) - LV_KEY_CTRLC constant + Ctrl+C interception in LVGL keyboard hook - Window owner PID tracking (windows.pas) - ISR_32 gate override support (isrmanager.pas)
This commit is contained in:
@@ -29,11 +29,14 @@ unit contextswitcher;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
idt, isrmanager, processmanager, proctypes, util, tracer;
|
idt, isrmanager, processmanager, proctypes, util, syslog, tracer;
|
||||||
|
|
||||||
{ Initialise: overwrite IDT gate 32 with our custom ISR. }
|
{ Initialise: overwrite IDT gate 32 with our custom ISR. }
|
||||||
procedure init;
|
procedure init;
|
||||||
|
|
||||||
|
{ No idle ESP variable needed — idle is now a formal process (PID 0)
|
||||||
|
with its SavedESP managed like any other process. }
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ -----------------------------------------------------------------------
|
{ -----------------------------------------------------------------------
|
||||||
|
|||||||
@@ -82,6 +82,10 @@ function GetDirectoryListingFrom(Path : pchar; BaseDir : pchar) : PHashMap;
|
|||||||
procedure FreeDirectoryListing(map : PHashMap);
|
procedure FreeDirectoryListing(map : PHashMap);
|
||||||
function changeDirectoryFrom(Path : pchar; BaseDir : pchar; var NewDir : pchar) : TIsPathValid;
|
function changeDirectoryFrom(Path : pchar; BaseDir : pchar; var NewDir : pchar) : TIsPathValid;
|
||||||
function MakeAbsolutePath(Path : PChar) : pchar;
|
function MakeAbsolutePath(Path : PChar) : pchar;
|
||||||
|
function makeAbsolutePathFrom(Path : pchar; BaseDir : pchar) : pchar;
|
||||||
|
function resolvePathFrom(Path : pchar; BaseDir : pchar) : TIsPathValid;
|
||||||
|
function GetDirectoryListingFrom(Path : pchar; BaseDir : pchar) : PHashMap;
|
||||||
|
function changeDirectoryFrom(Path : pchar; BaseDir : pchar; var NewDir : pchar) : TIsPathValid;
|
||||||
|
|
||||||
//VFS Functions
|
//VFS Functions
|
||||||
function newVirtualDirectory(Path : pchar) : TError;
|
function newVirtualDirectory(Path : pchar) : TError;
|
||||||
|
|||||||
Reference in New Issue
Block a user