Thread of execution is the smallest sequence of programmed instructions that can be managed independently by scheduler. Thread is a component of process and so multiple threads can be associated in a process. Linux doesn’t have a separate threads per process limit, but has a limit on the total number of processes on the system (as threads just processes with a shared address space on Linux).
Our task is to find out maximum number of thread that can be created within a single process (maximum number of thread that pthread_create can create). Maximum number of threads can be seen is ubuntu by using command:
This thread limit for linux can be modified at runtime by writing desired limit to /proc/sys/kernel/threads-max.
Compile the following program on ubuntu operating system, to check maximum number of threads that can be created within a process in C.
cc filename.c -pthread where filename.c is the name with which file is saved.
Maximum number of thread within a Process is : 32754
This article is contributed by Aditya Kumar. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Maximum number of Zombie process a system can handle
- Difference Between Daemon Threads and User Threads In Java
- Create n-child process from same parent process using fork() in C
- fork() and memory shared b/w processes created using it
- Pass the value from child process to parent process
- Process states and Transitions in a UNIX Process
- Print 1 2 3 infinitely using threads in C
- Introducing Threads in Socket Programming in Java
- Communication between two process using signals in C
- MCQ on Memory allocation and compilation process
- Priority of process in Linux | nice value
- Double forking to prevent Zombie process
- Exit status of a child process in Linux
- Multi Threading Models in Process Management
- Inter-process Communication using a shared stack