LinuxQuestions.org
Help answer threads with 0 replies.
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 11-27-2005, 03:00 PM   #1
zahadumy
Member
 
Registered: May 2005
Location: Cluj, Romania
Distribution: Fedora Core 6
Posts: 226

Rep: Reputation: 31
A problem with threads creates 300+ zombie processes


I have a problem with 4 threads (I think it doesn't matter what I'm trying to do) and for each thread I call pthread_join. My problem is it makes 300+ zombie processes and after the program finishes, I have no more zombie processes, so I suppose it kills all of them somehow. The point is the problem works fine on my computer, but I'm a student and this is one of my homeworks, and I have to show this problem to a teacher at school, and I know we have there a 100 processes limit, and it won't work there.
In my thread function I call a popen like this:
Code:
    strcpy (s, "ps -axuf 2>/dev/null | grep ");
    strcat (s, a->nume_user);
    f = popen (s, "r");
I know it's not recommended to redirect the standard output or error and to make pipe linking within a popen, but I did it before and it worked fine. Could it be this? Do you have any idea why this happens?

Last edited by zahadumy; 11-27-2005 at 08:15 PM.
 
Old 11-27-2005, 08:15 PM   #2
zahadumy
Member
 
Registered: May 2005
Location: Cluj, Romania
Distribution: Fedora Core 6
Posts: 226

Original Poster
Rep: Reputation: 31
Problem solved. This happened because I forgot this:
Code:
pclose(f);
 
  


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
pthread_create creates a number of threads with same tid!!!! dravya Programming 5 08-11-2004 04:18 PM
My GOD. Fedora box spawns 300 processes nearly instantly gt_swagger Linux - Software 0 07-13-2004 11:35 AM
zombie processes mhr Linux - Newbie 1 06-19-2003 10:49 PM
postfix/spamassassin combo creates alot of processes. Pcghost Linux - Software 0 06-13-2003 05:07 PM
How to get rid of zombie processes ugge Linux - General 3 10-01-2001 10:09 AM

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

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