LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-26-2008, 09:13 AM   #1
sudevank
LQ Newbie
 
Registered: Mar 2007
Posts: 27

Rep: Reputation: 15
thread creation fails after a number of iteration


Hi,
I am running one service which creates three levels of threads . (ie main thread creates a thread , new one creates another like that ) and I am waiting for all threads by pthread_join call. The logic looks like below. But after a number(around 1500) of iteration pthread_create fails with error EAGAIN. Anybody having any idea?

main()

while (1)
{
create(thread1)
sleepforsometime()
}

thread1()
{

for i times
{
create (thread2)

}
wait for i threads //(thread2)

}
thread2()
{
do some works
return
}
 
Old 05-26-2008, 09:45 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
Quote:
Originally Posted by sudevank View Post
I am running one service which creates three levels of threads . (ie main thread creates a thread , new one creates another like that ) [...] But after a number(around 1500) of iteration pthread_create fails with error EAGAIN.
3 nesting levels, creating about 1500 threads each?
So, roughly: 3375000000 thread are created, and then your program fails reporting "EAGAIN" (which means according to the man page "not enough system resources").
Quote:
Anybody having any idea?
No. Sorry. Must be a kernel bug or something.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Thread Creation Problem ravi.srivastava Programming 6 11-14-2007 02:22 AM
Maximum Thread creation in solaris nav_123 Solaris / OpenSolaris 3 02-21-2007 02:14 AM
Thread Creation failing arunka Programming 1 07-18-2006 03:27 PM
display thread number in process tim24 Linux - General 4 07-07-2006 12:50 AM
RedHat 7.1 boot disk creation fails - need help Luke727 Linux - Software 0 08-04-2001 06:01 AM


All times are GMT -5. The time now is 06:42 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration