<div dir="ltr"><div>struct task_struct { </div><div>volatile long state;</div><div>void *stack;</div><div>...</div><div><b>pid_t pid;</b></div><div>...</div><div>}</div><div>You mean to say that just mapping the <b>pid_t pid</b> will do the job. Does the linux kernel not store pid somewhere else while forking a child?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 21, 2016 at 4:18 PM, Pranay Srivastava <span dir="ltr"><<a href="mailto:pranjas@gmail.com" target="_blank">pranjas@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Nitin,<br>
<span class=""><br>
<br>
On Mon, Mar 21, 2016 at 4:03 PM, Nitin Varyani <<a href="mailto:varyani.nitin1@gmail.com">varyani.nitin1@gmail.com</a>> wrote:<br>
> .....Continued.... That is, if kernel at Computer 2 finds that pid of a<br>
> process requesting a system call is 1500, the request is forwarded to slave<br>
> daemon which in turn contacts with the master daemon. Master daemon requests<br>
> the kernel for the system call and sends the result back to slave daemon.<br>
<br>
</span>I don't think doing this by pid is better. It might suit you currently<br>
but in the long run?<br>
If you are able to send the whole context, why not map that pid to<br>
your context internally instead of relying<br>
on pid which is also visible outside your context.<br>
<span class=""><br>
><br>
> On Mon, Mar 21, 2016 at 4:01 PM, Nitin Varyani <<a href="mailto:varyani.nitin1@gmail.com">varyani.nitin1@gmail.com</a>><br>
> wrote:<br>
>><br>
>> I am trying to create a distributed pid space.<br>
>><br>
>> 0 to 2000 Computer 1<br>
>> 2001 to 4000 Computer 2<br>
>> 4001 to 6000 Computer 3<br>
>><br>
<br>
</span>your pid 2000 shouldn't have to be same pid 2000 on another node. You<br>
just need the context right?<br>
<div><div class="h5"><br>
>> and so on...<br>
>><br>
>> I am running a master user-level process at Computer 1 which sends a<br>
>> process context like code, data, registers, PC, etc as well as "pid" to<br>
>> slave processes running at other computers. The responsibility of the slave<br>
>> process is to fork a new process on order of master process and attach "pid"<br>
>> given by the master to the new process it has forked. Any system call on<br>
>> slave nodes will have an initial check of " Whether the process belongs to<br>
>> local node or to the master node?". That is, if kernel at Computer 2 pid of<br>
>> the process is 1500<br>
>><br>
>><br>
>><br>
>> On Mon, Mar 21, 2016 at 12:23 PM, <<a href="mailto:Valdis.Kletnieks@vt.edu">Valdis.Kletnieks@vt.edu</a>> wrote:<br>
>>><br>
>>> On Mon, 21 Mar 2016 10:33:44 +0530, Nitin Varyani said:<br>
>>><br>
>>> > Sub-task 1: Until now, parent process cannot control the pid of the<br>
>>> > forked<br>
>>> > child. A pid gets assigned as a sequential number by the kernel at the<br>
>>> > time<br>
>>> > the process is forked . I want to modify kernel in such a way that<br>
>>> > parent<br>
>>> > process can control the pid of the forked child.<br>
>>><br>
>>> What does controlling the pid gain you? To what purpose?<br>
>>><br>
>>> > Sub-task 2: On Linux, you can find the maximum PID value for your<br>
>>> > system<br>
>>> > with the following command:<br>
>>> ><br>
>>> > $ cat /proc/sys/kernel/pid_max<br>
>>> ><br>
>>> > Suppose pid_max=2000 for a system. I want that the parent process<br>
>>> > should be<br>
>>> > able to assign a pid which is greater that 2000 to the forked child.<br>
>>><br>
>>> Again, why would you want to do that?<br>
>>><br>
>>> Anyhow...<br>
>>><br>
>>> echo 3000 > /proc/sys/kernel/pid_max<br>
>>> fork a process that gets a pid over 2000.<br>
>>><br>
>>> Done.<br>
>>><br>
>>> Note that on 32 bit systems, using a pid_max of over 32768 will cause<br>
>>> various things in /proc to blow up.<br>
>>><br>
>>> I suspect that you need to think harder about what problem you're<br>
>>> actually<br>
>>> trying to solve here - what will you do with a controlled child PID? Why<br>
>>> does<br>
>>> it even matter?<br>
>><br>
>><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
---P.K.S<br>
</font></span></blockquote></div><br></div>