process

From NetBSD Wiki

(Redirected from PID)
Jump to: navigation, search
This article is a stub. You can help by editing it.

A process is just a running program. Every process has a unique process identifier. These so-called PIDs are assigned in an increasing fashion: the very first process is the swapper which has a PID of 0, and then init, which has PID 1. Init is the great-grandfather of all user processes. Any process whose parent gets killed (or simply exits normally) will be transfered to have init as its parent.

All information that is associated with a process is stored in its PCB (process control block), which is just called "proc" in the BSD kernel. See src/sys/sys/proc.h for the proc structure's definition. Most notably, this includes the process' owner (via which its permissions can be determined), its memory address space, a list of its open File descriptors, its signal mask and a pointer its LWPs (see below).

Light-weight processes

Light-weight processes or LWPs were introduced by the import of scheduler activations, which was finalised in NetBSD 2.0. A light-weight process is what one might call a kernel-level thread or "OS thread", as opposed to a user-level thread. Scheduler activations are a way to map any number of user-level threads to any number of kernel-level threads. They allow the user to implement a small application-specific scheduler just to schedule the available user-level threads onto kernel-level threads. I advise you to read the Williams paper (see the References section) to learn the specifics of this particular technique.

All light-weight processes are associated to a certain process. To distinguish between them, they have a LID (lwp ID) which is allocated local to the process. No information is duplicated between the lwp and the proc, since there's a pointer from either to the other. lwps basically only have scheduling information associated to them.

See also

References

  • W. Richard Stevens -- Advanced Programming in the Unix Environment
  • Marshall Kirk McKusick -- The Design and Implementation of the FreeBSD Operating System
  • Nathan Williams, Wasabi Systems, Inc. -- An Implementation of Scheduler Activations on the NetBSD Operating System USENIXAuthor's homepage
Personal tools