I have a question about implementing pthread on Linux.
Suppose a process has 5 threads. Now, as a scheduler sees these threads (or not at all). for example, When a scheduler is called, is it just scheduling the main process, and then its burden of the main process to schedule between each of its threads.
Or is it different that the scheduler schedules each thread as if it were a separate process.
For modern Linux (NPTL pthread implementation), the scheduler schedules threads, a thread is considered an "easy process". pthread_create is implemented in terms of a system call clone.
clone
Linux schedules each thread as if it were a process with scope PTHREAD_SCOPE_SYSTEM. An nptl implementation may use multiple processors.
, .
, , Linux .
, , - , TTY, TTY. , , 24- , . 50%, - 50%. glibc 24 , 33% , 33% - 33% - glibc.