Re: [PATCH] Provide system call to get task id

From: Miquel van Smoorenburg (
Date: Mon Oct 08 2001 - 17:15:39 EST

In article <>,
Linus Torvalds <> wrote:
>Now, I actually seriously doubt either of those are real issues, and it
>probably doesn't matter what we do. But I'd ratehr have a system call
>called "getpid()" do what POSIX threads have traditionally done, namely
>give the ID of the process group ("tpid" in linux kernel-speak), and have
>"gettid()" give the thread ID ("pid" in linux kernel-speak).

The kernel doesn't have pthread support - glibc emulates it using clone().
Shouldn't glibc then not also be the one to do the getpid() / gettid()
switching internally only for applications linked agains libpthread ?

If you want to have thread IDs I think you should go all the way
and make thread groups a real entity like sessions and process groups.
Setsid() would reset the thread group ID like it now also resets
the process group ID. Ditto for setpgrp() I think. A session can
contain several process groups which can contain several thread groups.

There should be a way to signal all processes in a thread group-
perhaps that should even be the default, a signal to any process
in the group should be delivered to all of them. Or perhaps only
for SIGSTOP and SIGKILL, all other signals could be delivered
to the thread group leader.

Anyway, food for thought.


Move sig.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to More majordomo info at Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Oct 15 2001 - 21:00:21 EST