Right. The fun starts when you do 'echo NNN > /proc/sys/kernel/pid_max' for some NNN > 32k. On 32bit boxes 64K is the limit due to the /proc inode wonkiness, but on 64bit kernels it's just a matter of how much RAM you have. ;)
And I guess this is depending on the selected frame size per process.
The numbers returned by getpid() and gettid() come out of the same PID space, and the vast majority of programs aren't thread-aware, and get their PID via fork() or vfork() anyhow...
True, to get the thread_id you either need to extract it via the POSIX pthread_* calls or, in case of Linux, you can use the non-portable gettid().
It's effectively an 'int' - any code that assumes a smaller range will fail in the most interesting ways in the near future... :)
Indeed. Thank you for your explanations. Best regards, Roberto Nibali, ratz -- echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq'|dc