pid and endpoint

2,007 views
Skip to first unread message

Wu Bingzheng

unread,
Jun 7, 2009, 8:24:34 AM6/7/09
to minix3
Hi,

There are a pid and an endpoint for each process.
What's the difference?
How can I get an endpoint from a pid.

I find this from internet, but I still in puzzle.
------
The purpose of PIDs is to uniquely identify the processes with respect
to UNIX system calls.

The purpose of endpoints is to uniquely identify processes with
respect
to Minix IPC primitives, as well as provide mapping to the process
table(s) as well as disambiguation about various processes which might
(over time) occupy the same slot).
-----

Thanks,
Wu

Guanqun Lu

unread,
Jun 7, 2009, 9:07:22 AM6/7/09
to min...@googlegroups.com
Hi Wu,

On Sun, Jun 7, 2009 at 8:24 PM, Wu Bingzheng<wubin...@gmail.com> wrote:
>
> Hi,
>
> There are a pid and an endpoint for each process.
> What's the difference?

pid is used by unix system calls, say getpid(), kill()...
while endpoint is only used in recv()/send() primitives.

> How can I get an endpoint from a pid.

./include/minix/endpoint.h
_ENDPOINT_P() this macro can safe you some time. :-)

>
> I find this from internet, but I still in puzzle.
> ------
> The purpose of PIDs is to uniquely identify the processes with respect
> to UNIX system calls.
>
> The purpose of endpoints is to uniquely identify processes with
> respect
> to Minix IPC primitives, as well as provide mapping to the process
> table(s) as well as disambiguation about various processes which might
> (over time) occupy the same slot).
> -----
>
> Thanks,
> Wu
> >
>



--
Guanqun

Wu Bingzheng

unread,
Jun 7, 2009, 9:25:30 AM6/7/09
to minix3
Thanks.

Are the endpoint and pid one-to-one (bijection) ?
Why not use a single identifier ?

On Jun 7, 9:07 pm, Guanqun Lu <guanqun...@gmail.com> wrote:
> Hi Wu,
>

Guanqun Lu

unread,
Jun 7, 2009, 10:02:00 AM6/7/09
to min...@googlegroups.com
Here's what I got when I searched this mailing list:

Endpoints are used for message passing and process identification.
If you send a message to an other process you will specify the
endpoint of the other process as identification.
This makes it also possible to have some magic endpoint values like
ANY and NONE.
Furthermore as far as i know endpoints are the only process
identification that is usable through the whole system.
For example PID numbers are not usable because only the process
manager is aware of PID's.
Endpoint numbers can be translated to the index number in the process
table of the kernel, process manager and file system.

then commented by Ben Gras:

Although this is all true, it's not a complete description of endpoint
numbers. What you describe is also true of the 'old' way of addressing
processes, which was by process slot number (index number in the
process table, ignoring the weird NR_TASKS offset).

Endpoints, which are indeed mappable to a slot number, were introduced
to distinguish a particular process in a slot from a new process in
the same slot, after the original has died and a new one has taken its
place. This way you avoid sending messages to a completely irrelevant
process.



HTH.
--
Guanqun
Reply all
Reply to author
Forward
0 new messages