|KTHREAD(9)||Kernel Developer's Manual||KTHREAD(9)|
pri, int flags,
struct cpu_info *ci,
void (*func)(void *),
const char *fmt,
Any process can request the creation of a new kernel thread. Kernel threads are not swapped out during memory congestion. The VM space and limits are shared with proc0 (usually swapper).
kthread_create(pri, flags, ci, func, arg, newlp, fmt, ...)
kthread_create() to select the default priority level.
NULL, the thread will be created bound to the CPU specified by ci, meaning that it will only ever execute on that CPU. By default, the threads are free to execute on any CPU in the system.
kthread_exit() to properly terminate itself.
func(). May be
NULLif not required.
KTHREAD_MUSTJOINis specified in flags.
The following flags are defined.
LSIDL(idle) state. By default, the threads are created in the
LSRUN(runnable) state, meaning they will begin execution shortly after creation.
SCHED_OTHERclass (timeshared). The thread's priority will be dynamically adjusted by the scheduler. Increased activity by the kthread will cause its priority to fall; decreased activity will cause its priority to rise. By default, kthreads are created in the
SCHED_RRclass, with a fixed priority specified by pri. Threads in the
SCHED_RRclass do not have their priority dynamically adjusted by the scheduler.
kthread_exit() will wait until
kthread_join() will be called.
KTHREAD_MUSTJOINflag and would wait on kthread_exit.
kthread_create() returns 0. Otherwise, the following error values are returned:
RLIMIT_NPROCon the total number of processes under execution by this user id would be exceeded.
|August 7, 2011||NetBSD-7.0.1|