Basic Question about Kernel Processes in FreeBSD.
John Baldwin
jhb at freebsd.org
Mon Jun 16 17:00:46 UTC 2014
On Monday, June 16, 2014 6:45:47 am 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.
>
> 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.
Yes, they share a single address space. There are other reasons you might
want to have separate processes. The aio kproc's actually "borrow" user
address spaces while doing I/O on behalf of a user process for example. You
might also want kprocs so that things show up as processes in top, etc.
There might also be other properties (like a cpuset set id) that you might
want to use with kthreads (but those only work for processes for example).
--
John Baldwin
More information about the freebsd-arch
mailing list