Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Fri, 6 Dec 2002 07:49:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Fri, 6 Dec 2002 07:49:15 -0500 Received: from mx1.elte.hu ([157.181.1.137]:2006 "HELO mx1.elte.hu") by vger.kernel.org with SMTP id ; Fri, 6 Dec 2002 07:49:14 -0500 Date: Fri, 6 Dec 2002 15:15:30 +0100 (CET) From: Ingo Molnar Reply-To: Ingo Molnar To: NPT library mailing list Cc: "Linux Kernel ML (E-mail)" Subject: Re: what's the relationship between tgid, tid and pid ? In-Reply-To: <200212052047.gB5Kle620684@magilla.sf.frob.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1300 Lines: 36 On Thu, 5 Dec 2002, Roland McGrath wrote: > "tgid" is the PID of the whole POSIX.1 process. > "pid" is a per-thread PID-like number. there's a "PID number space" under Linux, and "PID types". Each PID type allocates from the same base number space, but they can also share the same PID, ie. are overlayed: enum pid_type { PIDTYPE_PID, PIDTYPE_TGID, PIDTYPE_PGID, PIDTYPE_SID, the 'TGID' is the "process PID" as in POSIX.1. The 'PID' is the same for standalone processes and for leader threads, it's different for threads. Furthermore, the PID is also globally unique, and is recognized by the sys_tkill() interface - ie. you can send signals between threads of different "processes". The 'PGID' is the process group PID. The 'SID' is the session ID. the kernel guarantees reference counting, ie. only when the last type detaches a given number is it allocatable again. This is partly required by semantics for things like the PGID and the SID, and it's simply handy for things like the thread identificator. Ingo - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/