os: CurrentProcess resources, processors and memory limit (OS slice 2, part 3) #252
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
The second half of
CurrentProcess(OS.md section 5.9): what the process has used and what it is held to. Split from #126 (OS slice 2).Source
Current state on main
No
CurrentProcessexists yet; the first half (identifier,parentIdentifier,executable,workingDirectory,uptime) is #251 and createsstd/os/src/process.trb.ByteSizeis #126.Scope
On
CurrentProcess:resources(): Result<ProcessResources, OsError>(userTime,systemTime,resident,peakResident;getrusageon POSIX with theru_maxrssunit arm of OS.md,GetProcessTimesandGetProcessMemoryInfoon Windows),processors(): Result<Int, OsError>(affinity mask, container CPU quota rounded up:sched_getaffinityplus cgroupcpu.maxon Linux,GetProcessAffinityMaskplus job-object CPU rate on Windows,hw.ncpuon macOS),memoryLimit(): Result<ByteSize?, OsError>(cgroupmemory.maxv2 and v1 on Linux, job-object limit on Windows,Noneon macOS). FreeBSD arms answerUnsupporteduntil the FreeBSD slice.Acceptance criteria
resources(): after a loop that burns processor time and allocates 64 MiB,userTime + systemTime > 0,resident > 0,peakResident >= residenton linux-x64, linux-arm64, macos-arm64 and windows-x64; theru_maxrssunit conversion is a pure function tested on every machine with captured values for both units.processors()is between 1 and the machine's processor count; the cgroupcpu.maxparser is pure and tested with captured files (max 100000,150000 100000, v1cpu.cfs_quota_usof -1).memoryLimit()answersOk(None)without a limit andOk(Some(n))with one; the cgroupmemory.maxparser (max, a number, a missing file) is pure and tested; a denied or hidden/sysisOk(None), not an error, and the doc comment says so.torb check --every-target std/osis clean; docs updated,skills/regenerated.Seed
None: the compiler does not use these natives, so one commit adds natives and their users together (
feat(os): ...).Size
One PR, one Conventional Commit.
Dependencies
#251 (creates the module) and #126 (
ByteSize).CurrentProcessidentity, executable and working directory (OS slice 2, part 2) #251ByteSize, memory and the current process (OS slice 2) #126ByteSize, memory and the current process (OS slice 2) #126ByteSize, memory and the current process (OS slice 2) #126[loop:torbscript] intake: in scope (author orion, label loop, split from #126), not a duplicate, no collision with a design record (OS.md 5.9). Body is complete. next: waiting (dependency #251 creates std/os/src/process.trb) until 2026-10-10T04:00:00Z
[loop:torbscript] refine: ready as written. Dependency #251 part 1 landed (PR #262, std/os/src/process.trb exists with CurrentProcess); #126 landed (ByteSize). No seed impact (the compiler uses none of the new natives), so one commit is enough.
[loop:torbscript] claim implement by session:loop-torbscript-20261009 until 2026-10-09T16:20Z
const r: RingList<Int> = [1, 2]) #212[loop:torbscript] close: PR #263 approved and merged by argus at 2026-10-09T12:02Z as
0a1a03f0(feat(os): add CurrentProcess resources, processors and memory limit); the issue closed with the merge. Main CI on0a1a03f0is running at the time of this comment. Claim released. OS slice 2 part 2 (#251) still waits for a published seed.