Thread: Multi-threading optimization technics description

  1. #1
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788

    Lightbulb Multi-threading optimization technics description

    In recent times, has appeared more and more post related to code optimization for Multi-Threading. This inspired me to share the following link.

    http://blog.radvision.com/codeofcont...-stack-and-me/

    In the article, my coworker shares his experience of optimizing the code for better utilization of multi-core systems. I hope this information will be useful for everyone interested on the matter.
    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

  2. #2
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,834
    Thanks! I am currently looking into multi-code programming. I just wish there were less fancy threading tools and instead, more emphasis to have simple C calls to disperse loops or functions to the different cores.

    I've been trying to gather information on the trends for parallel (multi-core) programming and all I can come up with are more gobbledygook about "algorithm templates", "affinity partitioner" class, "broad array of parallel programming models" and "Threaded building blocks".

    Can the OOPS people please get the hell off my lawn. I'm a C programmer and want ways to talk to specific cores - I'll write assembly routines if I have to. What I don't want is OOPSification of everything under the sun when I've managed to remain a dinosaur and happy.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    I just wish there were less fancy threading tools and instead, more emphasis to have simple C calls to disperse loops or functions to the different cores.
    I wish there were more fancy threading tools. Muti-threaded programming is hands down the hardest thing to do in programming.

    It seems like every project I work on can be composed of 2 steps:
    1) Design and implementation (12 weeks).
    2) Debugging deadlocks and race conditions (20+ weeks).

  4. #4
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Other than the fact he is an obvious closet smoker, I would say he spent an entire article explaining what is basically the first thing they teach you in optimization class, whether it is multi-threaded or not.

    1. ALWAYS SPEND YOUR TIME OPTIMIZING THE MOST EXPENSIVE SECTION OF CODE. OPTIMIZATIONS THERE WILL HAVE THE BIGGEST PAY-OFF.

    What he only really got into in a roundabout way is that you should first take that bottleneck section and break it up into its individual component peices. First, throw out everythign that does nothing. That means all your little 12 line
    Code:
    // I love Eggs
    and
    Code:
    /* This function does something to something using some method or another and should not be removed under penalty of a severe infestation of Genetically Modified Anal Dwelling Butt Monkey
    */
    All the hyperbole about well commented code aside, that white noise just gets in the way. The people you should have doing your optimizations are SURPRISE SURPISE the people that wrote the original code. Have them do it immediately after they get the code working, whent eh design and any nuances in teh code are still fresh in their mind. Do not assign them any other tasks, make optimizing that code their one and only performance gauge for whatever amount of time you deem economically feasable. It will take at least 3 times as long to get teh same results if you wait a couple months in between writing and optimizing the code. If you wait 6 months, forget it, its probably easier to just as them to rewrite the code and then optimize that new code.
    Last edited by abachler; 04-01-2009 at 06:35 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. overlapped I/O and multi threading
    By krishnampkkm in forum C++ Programming
    Replies: 2
    Last Post: 06-22-2009, 03:27 PM
  2. Multi Threading
    By beon in forum C Programming
    Replies: 5
    Last Post: 12-04-2006, 09:21 PM
  3. Replies: 6
    Last Post: 06-02-2006, 08:32 AM
  4. starting to learn multi threading
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 06-09-2004, 01:44 PM
  5. Multi Threading
    By IceBall in forum C Programming
    Replies: 7
    Last Post: 07-13-2003, 03:01 PM