kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: bernd@petrovitsch.priv.at (Bernd Petrovitsch)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Attach my own pid
Date: Tue, 22 Mar 2016 11:25:13 +0100	[thread overview]
Message-ID: <1458642330.28358.21.camel@thorin> (raw)
In-Reply-To: <247784.1458624395@turing-police.cc.vt.edu>

On Die, 2016-03-22 at 01:26 -0400, Valdis.Kletnieks at vt.edu wrote:
> On Mon, 21 Mar 2016 16:01:41 +0530, Nitin Varyani said:
> 
> > I am running a master user-level process at Computer 1 which sends a
> > process context like code, data, registers, PC, etc as well as *"pid"* to
> > slave processes running at other computers. The responsibility of the slave
> > process is to fork a new process on order of master process and attach *"pid"
> > *given by the master to the new process it has forked. Any system call on
> > slave nodes will have an initial check of " Whether the process belongs to
> > local node or to the master node?". That is, if kernel at Computer 2 pid of
> > the process is 1500
> 
> None of that requires actually controlling the PID of the child.

Well, I think that the OP wants to map the PIDs with a fixed offset per
host. So e.g. the local PID == 14 becomes 20014 on all other nodes.
At least for debugging it's easier than some random mappings;-)

As for top post: TTBOMK there is no SysCall for doing that.
* Perhaps one can achieve something similar with containers - one
  container per remote host or so (but I never used containers actively
  myself) or (ab)use KVM (does vServer still live?) for local
  "pseudo-VMs" (and use there the original PIDs - or so).
* The manual page of clone(2) doesn't reveal to me if it's possible to
  wish for a PID.
* You could clone (pun not intended;-) the fork() syscall and add an
  parameter - the PID - to it (and e.g. return -1 if it's already used).

BTW I don't know how the rest of the kernel reacts to such artifical
PIDs (but you will see;-) outside the "official range".

MfG,
	Bernd
-- 
"What happens when you read some doc and either it doesn't answer your
question or is demonstrably wrong? In Linux, you say "Linux sucks" and
go read the code. In Windows/Oracle/etc you say "Windows sucks" and
start banging your head against the wall."    - Denis Vlasenko on lkml

  reply	other threads:[~2016-03-22 10:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-20  9:07 Attach my own pid Nitin Varyani
2016-03-20 18:33 ` Valdis.Kletnieks at vt.edu
2016-03-21  5:03   ` Nitin Varyani
2016-03-21  6:53     ` Valdis.Kletnieks at vt.edu
2016-03-21 10:31       ` Nitin Varyani
2016-03-21 10:33         ` Nitin Varyani
2016-03-21 10:47           ` Nitin Varyani
     [not found]           ` <CA+aCy1G351o4w-SFKaic_o-2MDOqNN+dTNfJEQteQof8CvopCQ@mail.gmail.com>
2016-03-21 11:04             ` Nitin Varyani
2016-03-22  3:22               ` Pranay Srivastava
2016-03-22  5:26         ` Valdis.Kletnieks at vt.edu
2016-03-22 10:25           ` Bernd Petrovitsch [this message]
2016-03-27 11:27             ` Nitin Varyani
2016-03-27 11:31               ` Nitin Varyani
2016-03-22  8:08 ` Mike Krinkin

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=1458642330.28358.21.camel@thorin \
    --to=bernd@petrovitsch.priv.at \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /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;
as well as URLs for NNTP newsgroup(s).