OpenSolaris邮件列表中关于进程数据结构的讨论

发表于:2007-06-08来源:作者:点击数: 标签:
转载自: OpenSolaris: code Matt - Looks like a cool idea. For basic information on processes, check out: usr/src/uts/common/sys/proc.h This give you a 'proc_t', the basic type for processes. Each process has any number of threads (kthread_

转载自:OpenSolaris: code



Matt -

Looks like a cool idea. For basic information on processes, check out:

usr/src/uts/common/sys/proc.h

This give you a 'proc_t', the basic type for processes. Each process
has any number of threads (kthread_t) associated it. And each thread
may or may not have an lwp associated with it (klwp_t). Kernel threads
do not have an associated lwp, while userland processes do.

A single threaded program will appear as a proc_t with a single thread i
'p_tlist'. A multithreaded program will still be a single process, but
have multiple threads in 'p_tlist'. The proc_t serves as a single point
for process control, as well as process-wide information common to all
threads.

The 'libproc' library in userland is an entirely different beast, and is
a layered control library built on top of /proc. See
http://www.opensolaris.org/os/community/observability/process/libproc/
for more info.

The best way to learn this stuff is a combination of 'mdb -k' and
DTrace. Try "::walk proc", "::walk thread", or "::pgrep bash | ::walk
thread", and "::print" is your friend.

On Fri, Jun 24, 2005 at 11:18:43AM -0700, Matthew Melton wrote:
> I'm trying to write a Wiki detailing OpenSolaris. I would appreciate help with this, after all, Wikis are a community effort!
>
> The wiki, for now, is located here: http://kernelbits.org/OSWiki
>
> At present, the only thing i've focused on are threads, as Solaris threads are rather interesting (well, brilliant imo).
>
> http://kernelbits.org/OSWiki/doku.php?id=threads
>
> I have a question about processes! I don't quite understand where processes are defined in the source. As I see it, a process is just an abstraction of a thread - that is, a single threaded program is the same as a single thread in the kernel. Therefore, a process is merely the enforcement of restraints on a thread. However, I cannot see where the process enforcements come in.
>
> There is a userspace process library, but I cannot see anything else in kernel land!?!
>
> Im also completely bamboozed about the number of queue types too. Buts thats another issue.
>
> If anyone could offer an explaination, please do so here, or on the wiki! :D
>
> Matt


原文转自:http://www.ltesting.net