Skip to content

0.17.1 --- kal_task_current without a system call - #35

Merged
Sunrisepeak merged 2 commits into
mainfrom
current-without-syscall
Oct 31, 2026
Merged

Sunrisepeak merged 2 commits into
mainfrom
current-without-syscall

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

kal_task_current issued thread_selfid at every call. openkal-musl finds errno, thread-specific data and every emulated thread-local variable of an ok image through it: 1.58 million calls in one clangd --check of mcppls-clangd's freestanding acceptance case (counted on Linux with an instrumented okrun). That was the whole of clangd.okb's difference from the native clangd on the macOS arm64 runners (1.25–1.96× across six runs; the same aarch64 image runs at 1.02× on Linux arm64, where openkal-linux caches the identifier per thread). Forcing the system call per answer on Linux reproduces the direction: 851 ms → 985 ms median.

pthread_threadid_np(NULL, &id) answers the same kernel identifier from the record libSystem keeps for each thread, without entering the kernel; the system call remains for a thread that record lacks. The value is unchanged, so nothing above observes a difference but the cost. _pthread_threadid_np joins the permitted imports and port/libSystem.tbd (a name no C library in this ecosystem defines).

Co-authored-by: speak-agent 248744407+speak-agent@users.noreply.github.com

Sunrisepeak and others added 2 commits November 1, 2026 07:19
…cord the system's library keeps, without a system call

Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
@Sunrisepeak
Sunrisepeak merged commit 63e9257 into main Oct 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant