Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8807809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:27:38+00:00 2026-06-14T02:27:38+00:00

I have the following code and I make ps aux | grep myprogram in

  • 0

I have the following code and I make ps aux | grep myprogram in each step of the main() code of myprogram (name of the application I build).

At the beggining of the execution of myprogram, the ps aux | grep myprogram show only 1 time the myprogram in the list

after cancelling a thread that I created in the begging of the main(), the ps aux | grep myprogram show the myprogram twice and I expected to get only 1.

Could some one explain this behaviour? and how to return to the initial situation (only 1 myprogram)

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

pthread_t test_thread;

void *thread_test_run (void *v)
{
    int i=1;
    while(1)
    {
       printf("into thread %d\r\n",i);
       i++; 
       sleep(1);
    }
    return NULL
}

int main()
{
    // ps aux | grep myprogram  ---> show only 1 myprogram

    pthread_create(&test_thread, NULL, &thread_test_run, NULL);

    // ps aux | grep myprogram  ---> show  3 myprogram

    sleep (20);  


    pthread_cancel(test_thread);

    // ps aux | grep myprogram  ---> show 2 myprogram and I expected only 1 !!??

   // other function are called here...

    return 0;
}

EDIT

the libc used by the linux is libc-0.9.30.1.so

# ls -l /lib/| grep libc
-rwxr-xr-x    1 root     root        16390 Jul 11 14:04 ld-uClibc-0.9.30.1.so
lrwxrwxrwx    1 root     root           21 Jul 30 10:16 ld-uClibc.so.0 -> ld-uClibc-0.9.30.1.so
lrwxrwxrwx    1 root     root           21 Jul 30 10:16 libc.so.0 -> libuClibc-0.9.30.1.so
-rw-r--r--    1 root     root         8218 Jul 11 14:04 libcrypt-0.9.30.1.so
lrwxrwxrwx    1 root     root           20 Jul 30 10:16 libcrypt.so.0 -> libcrypt-0.9.30.1.so
-rw-r--r--    1 root     root       291983 Jul 11 14:04 libuClibc-0.9.30.1.so
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T02:27:40+00:00Added an answer on June 14, 2026 at 2:27 am

    I’ll assume you have some outdated glibc (version 2.2 or 2.3), which used the “linuxthreads” implementation of pthread.

    In this older library one additional thread is created by the library for thread management; it can be created after first call to pthread_create; but it will sleep most time.

    In newer linuxes there is glibc with NPTL (“Native posix thread library”) implementation. When it is used, you will not see threads in ps axu; use ps axum (with m) to see native threads. And NPTL not uses a management thread.

    PS Check http://pauillac.inria.fr/~xleroy/linuxthreads/faq.html D.5 answer:

    D.5: When I’m running a program that creates N threads, top or ps display N+2 processes that are running my program. What do all these processes correspond to?

    Due to the general “one process per thread” model, there’s one process for the initial thread and N processes for the threads it created using pthread_create. That leaves one process unaccounted for. That extra process corresponds to the “thread manager” thread, a thread created internally by LinuxThreads to handle thread creation and thread termination. This extra thread is asleep most of the time.

    PPS: Thanks, Mohamed KALLEL; thanks, mux: libc-0.9.30.1 is uClibc and seems that it uses same outdated linuxthreads implementation (which is known to be not fully posix-compatible). Here is changelog: http://web.archive.org/web/20070609171609/http://www.uclibc.org/downloads/Changelog

    0.9.10 21 March 2002

    Major new features:
    o pthreads support (derived from glibc 2.1.3’s linuxthreads library)
    by Stefan Soucek and Erik Andersen

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code to make a jsonp call. var contacts; $.ajax({ url:
I have the following code where I make an copy of my database that
In YUI I have following code working for mouse wheel. How do I make
I have the following code to validate two text box entries to make sure
I have the following code; I want to make sure that submit does not
What do I have to change from the following code to make the Storyboard
What do I have to change in the following code to make the A
I have following code <div id=main> <div id=one> </div> <div id=two> </div> <div id=three>
I have a following code: $(document).ready(function() { $('a[rel]').each(function() { $(this).qtip( { content: { text:
I have write following code to make a navigation bar following demo . <ul

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.