141 std::function<Result<RegisterValue>(std::span<const RegisterValue> args,
ProcessImage &caller)>;
202 [[nodiscard]]
virtual Tick now() const noexcept = 0;
Block — the fundamental unit of simulated memory.
virtual Result< void > tick(std::size_t tickBudget=0)=0
Executes one dispatch cycle.
virtual Result< RegisterValue > syscall(ProcessId pid, SyscallId id, std::span< const RegisterValue > args)=0
Dispatches a syscall on behalf of a process.
virtual Result< void > registerSyscallHandler(SyscallId id, SyscallHandlerFn handler)=0
Registers or replaces syscall handler.
virtual Result< void > leaveCritical(ProcessId pid, std::string_view primitiveName)=0
Releases a named synchronization primitive.
virtual Tick now() const noexcept=0
Returns current simulation time.
virtual Result< void > enterCritical(ProcessId pid, std::string_view primitiveName)=0
Acquires a named synchronization primitive.
virtual Result< void > registerSyncPrimitive(const std::string &name, std::unique_ptr< ISyncPrimitive > primitive)=0
Registers a named synchronization primitive.
virtual Result< ProcessId > createProcess(const ProcessConfig &config)=0
Creates and admits a process.
virtual Result< void > runForTicks(std::size_t cycles, std::size_t tickBudget=0)=0
Executes multiple dispatch cycles.
virtual std::size_t processCount() const noexcept=0
Returns total managed process count.
virtual Result< void > terminateProcess(ProcessId pid)=0
Terminates a process immediately.
virtual ~IKernel()=default
Virtual destructor for interface-safe polymorphic cleanup.
virtual bool hasProcess(ProcessId pid) const noexcept=0
Returns true when process exists in dispatcher.
virtual KernelSnapshot snapshot() const =0
Returns a snapshot of current kernel state.
Common interface for synchronization primitives.
Full in-memory representation of a process.
A result type that holds either a success value of type T or an ErrorCode.
Error codes and Result<T> type for fallible operations.
ProcessState
All possible states in a process lifecycle.
@ New
Process has been created but not yet admitted to the ready queue.
PriorityLevel
Discrete priority levels, from highest (Realtime) to lowest (Idle).
@ Normal
Default priority for user processes.
std::function< Result< RegisterValue >(std::span< const RegisterValue > args, ProcessImage &caller)> SyscallHandlerFn
Function signature used for syscall registration.
std::uint64_t Tick
Simulation clock tick counter.
std::uint32_t ProcessId
Unique identifier for a process.
SyscallId
Numeric identifiers for system calls.
constexpr ProcessId INVALID_PID
Sentinel value indicating an invalid/unassigned process ID.
constexpr std::int32_t NICE_DEFAULT
Default nice value (no adjustment).
Process priority levels and the Priority struct.
ProcessState enum class and validated state transitions.
Lightweight process row for diagnostics and TUI rendering.
PriorityLevel effectivePriority
Effective/dynamic priority.
std::optional< std::size_t > laneIndex
Optional scheduler lane ownership metadata.
std::int32_t nice
Nice value used for fine-grained priority adjustments.
ProcessState state
Current process lifecycle state.
PriorityLevel basePriority
Base/static priority.
std::string name
Process name.
Tick cpuTime
Total CPU time consumed by process.
Lightweight kernel state snapshot for UI and diagnostics.
std::size_t totalVirtualSlots
Total number of virtual memory slots.
std::size_t readyCount
Number of processes in the ready queue.
std::size_t blockedCount
Number of processes in blocked state.
std::vector< ProcessId > runningPids
Process IDs currently running across dispatcher/scheduler lanes.
std::vector< std::optional< ProcessId > > frameOwners
Optional frame ownership map (one entry per frame).
std::optional< std::size_t > totalFrames
Optional total number of physical frames.
std::string policyName
Active scheduling policy name.
std::vector< ProcessId > blockedQueue
Blocked queue PID snapshot.
std::vector< KernelProcessSnapshot > processes
Process rows for UI tables.
std::vector< std::vector< ProcessId > > perLaneReadyQueues
Per-lane ready queue snapshots.
std::optional< std::size_t > freeFrames
Optional free physical frame count.
std::size_t freeVirtualSlots
Number of free virtual memory slots.
Tick currentTick
Current simulation tick.
std::size_t processCount
Total number of managed processes.
std::vector< ProcessId > readyQueue
Ready queue PID snapshot.
Composite priority descriptor for a process.
Configuration payload used to create a process.
std::vector< Block > code
Program code segment. Required for interpreter-backed processes.
Priority priority
Initial scheduling priority.
std::string name
Human-readable process name.
Tick arrivalTime
Arrival timestamp override. Defaults to current clock tick.
std::string nativePath
Optional path to a native host executable.
Syscall IDs for the user-kernel boundary.
Common type aliases, sentinel constants, and forward declarations used throughout the Contur 2 kernel...