5
votes

Is Linux Kernel scheduler a part of init process? My understanding is that it is part of Kernel threads managed internally not visible to user by either top or ps. Please correct my understanding.

Is it possible to view standard kernel threads through any kernel debugger to see how standard threads occupy cpu activity?

-Kartlee

2

2 Answers

7
votes

Kernel threads can be seen through "top" and "ps" and can be distinguished by having zero VM size (they have no userspace, so no userspace memory map).

These are created by kernel_thread (or its friends). Some facilities create one thread per CPU and tie it to a CPU, so you see stuff like aio/0 aio/1 on the PS list.

Also some work is done through the several deferred execution mechanisms and gets attributed to other tasks, typically something called "events/0" (one per CPU). Time spent "really" in interrupts isn't counted anywhere (it just runs at the expense of whatever task happened to be on that CPU at the time).

1
votes

1) Is Linux Kernel scheduler a part of init process?

-> no, scheduler is a subsystem, init process is just process but special and is scheduled by scheduler.

2) My understanding is that it is part of Kernel threads managed internally not visible to user by either top or ps. Please correct my understanding.

-> It is a kind of kernel thread and typically not shown to user.

3) Is it possible to view standard kernel threads through any kernel debugger to see how standard threads occupy cpu activity?

-> yes!