72 std::function<Result<RegisterValue>(std::span<const RegisterValue> args,
ProcessImage &caller)>;
132 [[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 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.
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.
Process priority levels and the Priority struct.
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.
ProcessId runningPid
PID of the currently running process or INVALID_PID.
std::size_t freeVirtualSlots
Number of free virtual memory slots.
Tick currentTick
Current simulation tick.
std::size_t processCount
Total number of managed processes.
Composite priority descriptor for a process.
Configuration payload used to create a process.
std::vector< Block > code
Program code segment.
Priority priority
Initial scheduling priority.
std::string name
Human-readable process name.
Tick arrivalTime
Arrival timestamp override. Defaults to current clock tick.
Syscall IDs for the user-kernel boundary.
Common type aliases, sentinel constants, and forward declarations used throughout the Contur 2 kernel...