From 06cd3ac67f9e039219df21d4bf63bf53b666355a Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 14 Jul 2024 13:19:10 +0300 Subject: expose max number of concurrent threads to users + Can be used to build fast hashmaps to speed up ipc --- include/kmi/syscalls.h | 9 +++++++++ include/kmi/tcb.h | 5 +++++ 2 files changed, 14 insertions(+) (limited to 'include') diff --git a/include/kmi/syscalls.h b/include/kmi/syscalls.h index 5079d74..4319812 100644 --- a/include/kmi/syscalls.h +++ b/include/kmi/syscalls.h @@ -258,6 +258,15 @@ enum conf_param { * \c R */ CONF_PAGE_SIZE, + + /** + * Maximum number of threads active at the same time. + * Can be used by userspace to build a pretty fast hashmaps of thread + * IDs to whatever, see \ref get_tcb(). + * Guaranteed to be some power of 2. + * \c R + */ + CONF_MAX_THREADS, }; /** Capabilities of process. */ diff --git a/include/kmi/tcb.h b/include/kmi/tcb.h index a6522f8..4214cb0 100644 --- a/include/kmi/tcb.h +++ b/include/kmi/tcb.h @@ -198,6 +198,11 @@ struct tcb { */ void init_tcbs(); +/** + * @return Maximum number of threads active at the same time. + */ +size_t max_tcbs(); + /** * Destroy thread control subsystem. */ -- cgit v1.3