Re: Kernel Internals

Alan Cox (alan@lxorguk.ukuu.org.uk)
Fri, 31 Jan 1997 19:50:36 +0000 (GMT)


> What does PID running in a specific range have to do with it? SCO has PIDs that run in a specific range *and* the size of the process table grows dynamically *and* the PID is the slot number in the process table. Also,

I don't believe that is correct. I don't believe that has ever been true. The
papers I have read on v7 unix indicate it was never true.

> isn't the task[]array the "process structure in the kernel." Looking through the kernel source, I only see references to tasks and not to processes. So, what structure is the "process structure"?

The task array is an array of pointers to task structures. task==process.

> - sending a kill to a particular processes
Correct.
> - doing a ps -p <PID>
That is done in user space.
> - passing the exit value of the process back to the parent
No.. the parent has a linked list of children.

> - Any time you need information about a speficic PID.
Signals are almost the only case of this.

> Here again, that wasn't the question. I know when the process table entry is cleared, I know what is kept in the the process table entry after the process dies, and I know what happens when there is no parent waiting on the child. So, to put the question as clear as I can:
>

That cannot occur. Process 1 always exists, processes are reparented as in
other unices. Init will clear them up

> Is it true that the parent process is responsible for clearing the process table of child processes or is this done by init or some other process, kernel function, whatever?

A process cleans up all but its process table slot on exit. That is cleaned
by its parent.

> In SCO, the virtual memory of each process between 3Gb-4Gb is for portions of the kernel that the process is using. So, when I am using a device, I have a particular driver loaded that ends up in the 3-4Gb range. Although two (or more) processes are waiting on the same event (i.e. input from the keyboard) and the WCHAN maps to the same function, the numeric WCHAN value is different. In Linux, both the numeric value and the address mapping is the same.

Linux wait queues are not the same as the Unix sleep hashing and scheduling

> This brings up the question of how kernel address space is mapped into the user's process space.

In 2.0.x the kernel is a different supervisor segment on intel in 2.1.x its
mapped into the top of the address space in the same segment for performance
reasons

Alan