Kernel: Process Scheduler: Difference between revisions

From TechPubs Wiki

Created page with "== Overview == The IRIX process scheduler is accessed primarily through the schedctl(2) system call, which provides a rich set of scheduling controls reflecting IRIX's historical focus on real-time, multiprocessor, and high-performance computing workloads. It supports: Real-time fixed-priority scheduling (non-degrading) Traditional UNIX nice-value adjustments (timeshare) Process group and user-wide nice operations (BSD compatibility) CPU affinity control Scheduling mode..."
 
No edit summary
 
Line 82: Line 82:
Porting: BSD nicer for nice/priority; lacks IRIX's unified interface and FRS. Real-time weaker than IRIX fixed-priority model.
Porting: BSD nicer for nice/priority; lacks IRIX's unified interface and FRS. Real-time weaker than IRIX fixed-priority model.
Overall, IRIX scheduler reflects strong SVR4 real-time heritage with unique extensions (FRS, gang modes). illumos provides closest conceptual match; BSD covers nice semantics well but lacks advanced features. For replication, focus on vproc abstraction and capability checks. FRS is largely IRIX-specific and hard to port directly.
Overall, IRIX scheduler reflects strong SVR4 real-time heritage with unique extensions (FRS, gang modes). illumos provides closest conceptual match; BSD covers nice semantics well but lacks advanced features. For replication, focus on vproc abstraction and capability checks. FRS is largely IRIX-specific and hard to port directly.
[[Category: Kernel Documentation]]

Latest revision as of 23:55, 9 January 2026

Overview

The IRIX process scheduler is accessed primarily through the schedctl(2) system call, which provides a rich set of scheduling controls reflecting IRIX's historical focus on real-time, multiprocessor, and high-performance computing workloads. It supports:

Real-time fixed-priority scheduling (non-degrading) Traditional UNIX nice-value adjustments (timeshare) Process group and user-wide nice operations (BSD compatibility) CPU affinity control Scheduling mode selection (free/gang) Full Frame Scheduler (FRS) interface for user-level hard real-time gangs Legacy hooks for older scheduling extensions

The implementation centers on vproc_t (virtual process) objects, which abstract scheduling attributes across processes/threads. Changes are applied via VPROC_ operations that update runqueue information safely.

Key Functions

Main Interface (schedctl) Single entry point dispatching commands:

MPTS_RTPRI / MPTS_GETRTPRI: Set/get real-time priority (range NDPHIMAX..NDPLOMIN). Superuser required except for self-demotion or within normal range. MPTS_SLICE: Set per-process time slice (ticks). MPTS_RENICE / variants: Adjust nice values for process, process group, or all processes of a user (emulating BSD setpriority/getpriority semantics). MPTS_SETHINTS: Initialize PRDA hints (obsolete pthread-related). MPTS_SETMASTER: Set scheduling master PID (legacy). MPTS_SCHEDMODE: Set scheduling mode (SGS_FREE, SGS_GANG, etc.). MPTS_AFFINITY_*: Enable/disable/query CPU affinity. MPTS_FRS_*: Full Frame Scheduler user interface (create, enqueue, yield, etc.).

Most operations require CAP_SCHED_MGT capability. Process List Scanner (plistscanner / plistscan) Utility for user-wide or group-wide operations:

Scans entire process table via procscan(). Handles renice/getnice across all matching processes. Safe credential access via pcred_access().

Undocumented or IRIX-Specific Interfaces and Behaviors

Scheduling Parameters

Real-time priorities: Fixed, non-degrading. Higher numerical value = higher priority. NDPHIMAX (highest), NDPNORMMIN (boundary to timeshare), NDPLOMIN (lowest RT).

Nice values: Traditional UNIX (-20..+19 translated via NZERO=20). Time slice: Configurable in ticks (default system-wide).

Scheduling Modes (via MPTS_SCHEDMODE)

SGS_FREE: Default independent scheduling. SGS_GANG: Gang scheduling (co-scheduling of related threads).

CPU Affinity Controlled via VPROC_SCHED_AFF; requires CAP_SCHED_MGT. Frame Scheduler (FRS) Hard real-time extension:

User-level creation of scheduling "frames" (gangs). Precise control over dispatch, yield, interrupt handling. All FRS operations require CAP_SCHED_MGT. Old FRS interface (MPTS_OLDFRS_*) returns ENOTSUP.

Batch Job Restrictions Processes in batch process groups (Miser) cannot be made real-time. Permission Model Heavy reliance on CAP_SCHED_MGT capability rather than simple uid==0 checks.

Similarities to illumos and BSD Kernel Implementations

illumos (Solaris-derived) Very close heritage (both SVR4 descendants):

schedctl-like interface existed historically in Solaris. Real-time fixed priorities (RT class). PRIORITY/NICE control via priocntl(2). Gang scheduling concepts (though Solaris used processor sets). Frame Scheduler unique to IRIX; Solaris had alternative real-time extensions.

Porting: illumos priocntl(2) system provides similar class/parameter control. FRS has no direct analog. BSD (FreeBSD, NetBSD, OpenBSD) More divergent:

Nice via setpriority/getpriority (exact semantics matched by IRIX MPTS_RENICE_* variants). Real-time via sched_setparam/sched_getparam (POSIX). CPU affinity via cpuset(2). No direct gang or frame scheduler equivalents. No unified schedctl; separate syscalls.

Porting: BSD nicer for nice/priority; lacks IRIX's unified interface and FRS. Real-time weaker than IRIX fixed-priority model. Overall, IRIX scheduler reflects strong SVR4 real-time heritage with unique extensions (FRS, gang modes). illumos provides closest conceptual match; BSD covers nice semantics well but lacks advanced features. For replication, focus on vproc abstraction and capability checks. FRS is largely IRIX-specific and hard to port directly.