Find the answer to your Linux question:
Results 1 to 5 of 5
Hello everybody, I'am coming back to the forum after a long time. Actually, I developed a multi-threaded C application(9 threads). This was done in linux RH9(using POSIX threads). And the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2004
    Posts
    3

    Multithreaded App in Linux


    Hello everybody,
    I'am coming back to the forum after a long time.

    Actually, I developed a multi-threaded C application(9 threads). This was done in linux RH9(using POSIX threads).

    And the same application was also done without any threads, but with a sequential procesing.This achieves the same task as that of its multi-threaded counterpart, except for the asynchronous processing.

    To my astonishment, I found that, the total virtual memory image[code + data +stack] in Linux(using 'ps' command), for the multi-threaded process was nearly 30 times as that of the non-multi-threaded application.

    I would appreciate programmers having experience in developing multi-threaded applications on linux to share their views.

    Could this be a problem with my multi-threaded design ? or is it a normal behavior for multi-threaded applications to have such a huge memory foot print ?

    Thanks

  2. #2
    Linux Engineer
    Join Date
    Jul 2003
    Location
    Stockholm, Sweden
    Posts
    1,296
    how about posting the source code for your aplication so we can take a look. Also.. perhaps the "programming" section would have been more apropriate for this kind of question.

  3. #3
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    ***Moved to Linux Programming & Scripting***
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  4. #4
    Linux Engineer
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    796
    There are many ways i have read that multithreaded applications can be treated by the kernel, but that is up to the programmer how he is creating its childs. And if that application will be faster of it...

    By fork, if so the whole memory map must be copied to the new process that will be an exact copy of its parent.

    Threads, will not be an exact copy of its parent, just exexuting its own part...

    Can it be possible if all threads are IO-bounded that its work is being qued in memory waiting for access to the disk, or something like that???

    Just brainstorming here...
    Regards

    Andutt

  5. #5
    Just Joined!
    Join Date
    Mar 2007
    Posts
    2

    Sample code to suspend a thread in linux

    Hi Can anybody post Sample code to suspend a thread in linux

    Thanks
    Harikrishna

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •