LinuxQuestions.org
Help answer threads with 0 replies.
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 02-20-2005, 02:36 PM   #1
JurajPsycho
Member
 
Registered: Sep 2004
Distribution: Debian, kernel 2.6.10
Posts: 50

Rep: Reputation: 15
threads


hi folks
I got program with more processes. It looks like just one (the firs spawned) of them is running without problem, the others run for while and then do nothing. But everything runs fine when I try to run it in dbg. Wtf?
J.
 
Old 02-20-2005, 03:07 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Can you give a little more info than that? You're not giving us very much to go on here. In what way are the other threads failing? Can you post some code that illustrates the problem? One thing to try is to have each thread print out a hello message to ensure it's been spawned correctly. If the hello message doesn't print, do you get some error from pthread_create (I'm assuming you're using pthreads here since you didn't tell us)?

Beyond that, more info needed.
 
Old 02-20-2005, 03:36 PM   #3
JurajPsycho
Member
 
Registered: Sep 2004
Distribution: Debian, kernel 2.6.10
Posts: 50

Original Poster
Rep: Reputation: 15
well, it's typical client - server program, where server creates processes to handle communication with clients. Processes are spawned correctly, they print some stuff few times, but after some time only the first spawned is running. The rest look like sleeping or suspended.
J.
 
Old 02-20-2005, 03:37 PM   #4
JurajPsycho
Member
 
Registered: Sep 2004
Distribution: Debian, kernel 2.6.10
Posts: 50

Original Poster
Rep: Reputation: 15
and yes, I'm using pthreads, it doesn't return any error.
J.
 
Old 02-20-2005, 09:57 PM   #5
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Are they sleeping waiting on incoming connections (selecting or polling on a file descriptor or group of file descriptors)? If so, that sounds like normal behavior based on what you've set about the app.
 
Old 02-22-2005, 08:58 AM   #6
JurajPsycho
Member
 
Registered: Sep 2004
Distribution: Debian, kernel 2.6.10
Posts: 50

Original Poster
Rep: Reputation: 15
ok, I solved that problem using sched_yield() command. It looks like one of the threads was not willing to give up it's CPU time....
J.
 
  


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
Java threads listed using kill -3 does not contain all threads found using ps -auxww coneheed Programming 2 11-14-2005 08:57 AM
c++ threads siemens Programming 4 07-10-2005 11:21 AM
Java Threads vs Native Threads rjmendez Programming 0 08-16-2004 05:58 AM
threads...... socket9001 Programming 4 04-26-2004 09:05 AM
Useful threads....... chingasman Linux - General 1 02-21-2003 09:23 AM

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

All times are GMT -5. The time now is 08:16 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