From: Chris Friesen <cfriesen@nortel.com>
To: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Cc: Olivier Croquette <ocroquette@free.fr>,
LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>
Subject: Re: Thread and process dentifiers (CPU affinity, kill)
Date: Thu, 19 May 2005 13:46:20 -0600 [thread overview]
Message-ID: <428CED0C.9020607@nortel.com> (raw)
In-Reply-To: <20050519182302.GE23621@csclub.uwaterloo.ca>
Lennart Sorensen wrote:
> On Thu, May 19, 2005 at 08:00:56PM +0200, Olivier Croquette wrote:
>>- a system call requiring a PID can have the same effect if a thread id
>>of the same process was given.
>>Example: kill(tid,SIGTERM) will kill the entire process the thread
>>belongs to. I think that this is not POSIX compliant. It shall trigger
>>ESRCH!
>
>
> How should kill know if you are sending a threadid or processid?
Doesn't matter. From a userspace point of view there is no process with
that PID, so kill() should return ESRCH. In the kernel, I think this
means that kill() should actually be looking up tgids rather than pids.
>>- is Linux kill() POSIX compliant in this regard?
> Does posix say that a process can't be allocated multiple PIDs?
PID="process ID"
You have one PID per process.
>>- do we want to limit the sched_setaffinity() functionality to
>>correspond to its documentation, or do we want to update the
>>documentation so that its covers all the functionality?
> I believe Linux currently implements threads as seperate processes
No, they are implemented as separately schedulable entities with lots of
shared state. "process" and "thread" are POSIX terms that don't really
mean anything in the kernel.
> Now given linux runs threads as seperate processes, it makes sense that
> thread ids and process ids are the same thing and hence currently
> unique, and that kill would work on any thread's pid within a given
> process.
Pthreads define signal handling. Signals are delivered to the process
as a whole, not to any particular thread. If you specify a TID that is
not a valid PID, then the kernel should return an error.
> Doesn't sched_setaffinity do what it says it will? Since each thread is
> treated as a process then sched_setaffinity should work on it I would
> think since it is a process after all as far as the scheduler is
> concerned.
If the syscall is supposed to operate on processes, it should operate on
all threads within a process. It would be nice to have a way to specify
affinity for threads. POSIX doesn't define one though.
Chris
next prev parent reply other threads:[~2005-05-19 19:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-19 18:00 Thread and process dentifiers (CPU affinity, kill) Olivier Croquette
2005-05-19 18:23 ` Lennart Sorensen
2005-05-19 19:46 ` Chris Friesen [this message]
2005-05-20 12:55 ` Lennart Sorensen
2005-05-20 14:51 ` Olivier Croquette
2005-05-20 16:53 ` Lennart Sorensen
2005-05-20 18:13 ` Miquel van Smoorenburg
2005-05-20 20:12 ` Lennart Sorensen
2005-05-23 12:56 ` Nix
2005-05-20 20:17 ` Olivier Croquette
2005-05-20 20:38 ` Lee Revell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=428CED0C.9020607@nortel.com \
--to=cfriesen@nortel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lsorense@csclub.uwaterloo.ca \
--cc=mingo@elte.hu \
--cc=ocroquette@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox