LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
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



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:09 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration