Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You may want to see the flag CLONE_THREAD, it will place the new thread in the same thread group as the calling process.</p> <p>Once you give the CLONE_THREAD, it will make the new thread have the same pid and ppid as the calling process. It is used in posix threads. Below is an output from my system. the LWP column says that is is now a light weight process and has different TID</p> <pre><code>UID PID PPID LWP C NLWP SZ RSS PSR STIME TTY TIME CMD anukalp 18398 9638 18398 0 2 464 456 0 10:56 pts/3 00:00:00 ./a.out anukalp 18398 9638 18399 0 2 464 456 1 10:56 pts/3 00:00:00 ./a.out </code></pre> <p>Also the output of /proc/self/status changes, I have added a couple of printfs:</p> <p>[anukalp@localhost ~]$ ./a.out</p> <pre><code>This process pid: 18398 Creating new thread... Done! Thread pid: 18399 /* This is now thread id, available to caller of clone */ getpid(): ad pid: 18399 Inside func. getpid(): 18398 getppid(): 9638 Looking into /proc/self/status... Name: a.out State: R (running) Tgid: 18398 Pid: 18398 PPid: 9638 TracerPid: 0 Uid: 500 500 500 500 Gid: 500 500 500 500 FDSize: 256 Groups: 7 19 22 80 81 82 83 100 490 500 VmPeak: 1856 kB VmSize: 1856 kB VmLck: 0 kB VmPin: 0 kB VmHWM: 248 kB VmRSS: 248 kB VmData: 168 kB VmStk: 140 kB VmExe: 4 kB VmLib: 1516 kB VmPTE: 16 kB VmSwap: 0 kB Threads: 2 SigQ: 1/14050 SigPnd: 0000000000000000 ShdPnd: 0000000000000000 SigBlk: 0000000000000000 SigIgn: 0000000000000000 SigCgt: 0000000000000000 CapInh: 0000000000000000 CapPrm: 0000000000000000 CapEff: 0000000000000000 CapBnd: ffffffffffffffff Cpus_allowed: 00000000,000000ff Cpus_allowed_list: 0-7 voluntary_ctxt_switches: 1 nonvoluntary_ctxt_switches: 0 Inside thread: thread pid = 18398 Inside thread: thread ppid = 9638 </code></pre> <p>Please let me know if this helps!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload