Like Tree2Likes
  • 2 Post By anduril462

Multi-thread programming help

This is a discussion on Multi-thread programming help within the C Programming forums, part of the General Programming Boards category; So I am very new to multi-thread programming using Pthread in Linux. Can someone show me an example of something ...

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    50

    Multi-thread programming help

    So I am very new to multi-thread programming using Pthread in Linux. Can someone show me an example of something like taking a list of numbers on the command line and will then create three separate worker threads.
    One thread determine the average of the numbers, second
    determine the maximum value, and third determine the
    minimum value.

    so if i put in, say:


    90 81 78 95 79 72 85

    Code:
    The program will report
    The average value is 82
    The minimum value is 72
    The maximum value is 95

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,676
    No, we can't show you an example that does exactly what your homework assignment asks you to do. But we can help you fix problems with whatever code you have written. I can also point you to this pthreads tutorial: https://computing.llnl.gov/tutorials/pthreads/.

    You can use that to get the hang of pthreads in general (not as difficult as it may seem). Then, you can modify their example to suit your needs. If you get stuck at any point, you can post the code you have here along with what problems you are having with it, and we'll be better able to help you.
    Salem and stahta01 like this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multi-thread server
    By music_man05 in forum C Programming
    Replies: 1
    Last Post: 12-04-2009, 05:15 PM
  2. multi-thread win32 programming
    By robig2 in forum Windows Programming
    Replies: 22
    Last Post: 01-16-2008, 01:34 PM
  3. Sound/multi thread....
    By CSoFun in forum C++ Programming
    Replies: 5
    Last Post: 01-18-2003, 07:39 PM
  4. Replies: 16
    Last Post: 08-24-2002, 09:44 AM
  5. Multi-Thread Programming
    By drdroid in forum C++ Programming
    Replies: 6
    Last Post: 04-04-2002, 02:53 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21