I apologize in advance for a possibly stupid question. I read about the maximum number of threads for one process in linux, and spontaneously the question arose, what is the minimum flow the process can have? Can a process have zero threads?

    1 answer 1

    A process must have at least 1 thread.

    • Is this a main function? Does she create that same flow? - Chebakov Dmitry
    • Do you mean C / C ++? I can’t be sure, because I didn’t work with it, but if by analogy with Java, then you can say so in simple language. When the program starts, a process is created, and the main function will control the main thread. - Danil
    • How does the main function control the main thread? If 10 threads are created, who will manage them? - de_frag 7:08 pm
    • one
      If a single process thread ends, the process will be terminated by the operating system itself. It makes no sense to keep the process with 0 threads, it does nothing, and nothing can be done. - Zergatul
    • 2
      I would venture to recall that the very concept of "Stream" was introduced in the standard POSIX.1-2001. Processes in NIX systems were originally. But the "threads" appeared much later. Those. the flow-free process is absolutely normal. When the program is started, the fork is executed, then exec . Neither there nor a word about streams. Moreover, in order for the program to be able to work with threads, at the linking stage, it is necessary to specify the -lpthread flag. And without it - no threads. - Sergey