From owner-cvs-all@FreeBSD.ORG Sat Apr 3 07:59:16 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5FD1016A4CE; Sat, 3 Apr 2004 07:59:16 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 586D843D2F; Sat, 3 Apr 2004 07:59:16 -0800 (PST) (envelope-from marcel@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i33FxDGe085917; Sat, 3 Apr 2004 07:59:13 -0800 (PST) (envelope-from marcel@repoman.freebsd.org) Received: (from marcel@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i33FxDMt085916; Sat, 3 Apr 2004 07:59:13 -0800 (PST) (envelope-from marcel) Message-Id: <200404031559.i33FxDMt085916@repoman.freebsd.org> From: Marcel Moolenaar Date: Sat, 3 Apr 2004 07:59:13 -0800 (PST) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/kern kern_fork.c kern_thr.c kern_thread.c src/sys/sys proc.h X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2004 15:59:16 -0000 marcel 2004/04/03 07:59:13 PST FreeBSD src repository Modified files: sys/kern kern_fork.c kern_thr.c kern_thread.c sys/sys proc.h Log: Assign thread IDs to kernel threads. The purpose of the thread ID (tid) is twofold: 1. When a 1:1 or M:N threaded process dumps core, we need to put the register state of each of its kernel threads in the core file. This can only be done by differentiating the pid field in the respective note. For this we need the tid. 2. When thread support is present for remote debugging the kernel with gdb(1), threads need to be identified by an integer due to limitations in the remote protocol. This requires having a tid. To minimize the impact of having thread IDs, threads that are created as part of a fork (i.e. the initial thread in a process) will inherit the process ID (i.e. tid=pid). Subsequent threads will have IDs larger than PID_MAX to avoid interference with the pid allocation algorithm. The assignment of tids is handled by thread_new_tid(). The thread ID allocation algorithm has been written with 3 assumptions in mind: 1. IDs need to be created as fast a possible, 2. Reuse of IDs may happen instantaneously, 3. Someone else will write a better algorithm. Revision Changes Path 1.225 +1 -0 src/sys/kern/kern_fork.c 1.18 +1 -0 src/sys/kern/kern_thr.c 1.175 +98 -2 src/sys/kern/kern_thread.c 1.373 +2 -0 src/sys/sys/proc.h