Thread: Multi-Core code

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    4

    Question Multi-Core code

    I want to know how I can get the most from my code, and as speeds per core stay the same, I am looking toward using multiple cores. Most GOOGLE searches come up with news articles talking about multiple cores, and multi-threading C. None of the two useful pages explained the functions at all. I speak C fluently. Please help me with this,

    tinkerC

  2. #2
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Standard C/C++ knows nothing about multithreading, so to get the best performance in your code you need to use OS specific functions or generic theading libraries like pthreads to make your code multithreaded.
    It would help to know what OS you are using in order to narrow down the function calls to a more specific set.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by tinkerC View Post
    I want to know how I can get the most from my code, and as speeds per core stay the same, I am looking toward using multiple cores. Most GOOGLE searches come up with news articles talking about multiple cores, and multi-threading C. None of the two useful pages explained the functions at all. I speak C fluently. Please help me with this,

    tinkerC
    Are you sure?

    multi core programming tutorial - Google Search

    Some links seems very interesting.
    Have you already studied Intel webinars on the issue? Intel is pushing very hard the multi-core programming and has a lot of info on it.
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    Registered User
    Join Date
    Apr 2009
    Posts
    4
    cpjust, do you know how to use the phtreads. I saw some use, but a useless explanation. Mac OS X 10.3 Panther. Could I make the phthreads portable to XP, later Mac OS X, and Vista? I know how to use the #if etc. directives. If you could point me to a site, thanks.

    tinkerC

  5. #5
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    Yes, POSIX Threads (pthreads) for Win32.

    I saw some use, but a useless explanation.
    Define "useful" then?

  6. #6
    Registered User
    Join Date
    Apr 2009
    Posts
    4
    Quote Originally Posted by cyberfish View Post
    Yes, POSIX Threads (pthreads) for Win32.


    Define "useful" then?
    It tells you how to use them. Function prototypes, definitions, or even explanations.

  7. #7
    Registered User
    Join Date
    Apr 2007
    Posts
    51
    Quote Originally Posted by tinkerC View Post
    It tells you how to use them. Function prototypes, definitions, or even explanations.
    No offense, but you didn't look very hard if you didn't find anything useful. A simple search on google for pthread and there are a bunch of links that give explanations.

    Also, use the link that vart gave and there is a pretty good run through on yolinux.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. Proposal: Code colouring
    By Perspective in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 05-14-2007, 07:23 AM
  3. Obfuscated Code Contest: The Results
    By Stack Overflow in forum Contests Board
    Replies: 29
    Last Post: 02-18-2005, 05:39 PM
  4. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM

Tags for this Thread