POSIX doesn't specify that the PID of each new process is obtained by incrementing the previous PID. It only requires it to be unique.
On a system where PIDs are incremented on each
fork(), I've observed that the values wrap around after reaching some upper bound (which in my experience is around 215). After wrapping around, new PIDs are not strictly incremented, since some PID values will still be in use from previous cycles.
There shouldn't be a problem until you have 2N simultaneously running processes. I suspect the system would run into some capacity limit long before that happened. In that case, the
fork() system call would fail and probably set
man fork for details).
The code that implements
fork may or may not check whether any PIDs are available. It might not bother, because it assumes that system resources would have run out before it got to that point, or it might have an explicit check for the sake of completeness and to handle future possibilities. I haven't checked, and if I had I could only address whichever kernel I had looked at.