Basic Question about Kernel Processes in FreeBSD.

Julian Elischer julian at freebsd.org
Mon Jun 16 13:48:16 UTC 2014


On 6/16/14, 6:45 PM, Dheeraj Kandula wrote:
> Hey All,
>          When I was reading through the FreeBSD kernel code came across the
> function kproc_create. This function creates a kernel process. Isn't it?
>
> But at some places in the code, there is mention that the address space is
> shared with proc0.

read the man pages in section 9
man kproc_create and all the "see also" pointers.

All kernel "processes" share the same address space.. that's why they 
are kernel processes :-)
they do however have separate accounting and scheduling resources.
there may be a number of kernel threads assigned to a simgle kernel 
process.

We really only have kernel processes to help us 'group' the threads, 
since all kernel threads see the same address space.
Origianlly we just had kernel threads (lots of them). Having kernel 
processes just allowed us to group them in 'top' for example.




>
> My Question:
>           Do all the kernel processes share the same address space. i.e.
> even though they are multiple processes, they share the same kernel address
> space. If so then why do we have kernel threads as threads are created in
> the first place to share the address space of a process so that they are
> light weight.
>
> Can someone shed some light on this. I am a bit confused about this. I
> though that processes doesn't exist in kernel context and only user
> processes existed.
>
> Dheeraj
> _______________________________________________
> freebsd-arch at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "freebsd-arch-unsubscribe at freebsd.org"
>
>



More information about the freebsd-arch mailing list