I'm wondering about the "punishment" that occurs when a new thread is created.
From my understanding of clone(2), NPTL (New POSIX Thread Library), CFS (Completely Fair Scheduler), when a new thread is created it is seen as a new process because NPTL uses a 1:1 thread model.
From what I've read about the scheduler, when a new process is added to the run-queue, the
fair_clock variable increases to a fraction of the wall clock.
From poking around the rituals with pthread_create(3), clone is eventually called just like it would in a fork(2).
Now, a process will have a 1:1 model and so will threads. So, does a thread also suffer this same exact fate as well? Obviously, a thread must be punished in some form or else a muti-threaded process can hog most of the CPU time by filling up the RR (round robin) system that CFS uses.
If this is true, then what are the advantages of using threads over forks? Is it just the automatic shared heap space (as opposed to using shm_open(2))?