0

I am currently investigate a question related to threads in the Linux OS. I know that processes are started by the scheduler in Linux Kernel, but what starts threads inside a process - Linux Kernel scheduler or another service in Linux Kernel?

Please help with this question.

Thanks

  • Start ? What do you mean by that ? (From the order given by a program to cpu's PC being initialized with the thread's start text address ?) – MC68020 Feb 19 '22 at 18:03

1 Answers1

1

In Linux, processes and threads are created by calling fork, clone, and other similar system calls and C library functions. Most programmers won’t call clone directly; instead they’d use a thread library (pthreads, C++ threads, and whatever other representation is used in their language of choice).

Both processes and threads are started by the scheduler. In fact, the scheduler in Linux mostly concerns itself with threads, and a process with “no” threads is really a thread with no siblings in the same process. See Why do threads have their own PID?

Stephen Kitt
  • 434,908