CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2008
    Posts
    1

    multithreading vs multi-machines?

    I'm an mechanical engineering student so I'm not extremely well informed when it comes to multithreading but I understand it can be a difficult process. I have however, read a few blogs that seem to indicate that programming across multiple machines is easier than on multiple cores. Is this true? Wouldn't the simple geographic overheads associated with multiple machine programming (distance, network problems, etc) cause huge problems?

    Thanks for the info guys
    Last edited by hwright; June 3rd, 2008 at 08:55 AM. Reason: format

  2. #2
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,641

    Re: multithreading vs multi-machines?

    Hi!

    No, multi-machine is even worse than multithreading.

    The separation of hardware means you must use multiple processes rather than multiple threads.
    Ordinary synchronization primitives cannot be used so you need to use other mechanisms to coordinate access to shared data. You also need to decide where the shared data should reside. It gets complicated.
    Nobody cares how it works as long as it works

  3. #3
    Join Date
    May 2008
    Posts
    300

    Re: multithreading vs multi-machines?

    It depends on what you do.

    For multi-threading, tasks have to wait each other for resources. And switching between threads in on execution core would slow things down.

    And multi-machines, resources are seperated, so tasks can run independently. However they have to have some relationship, you'll find that resources are seperated too much.

    If communication between tasks is relatively very little, and they depend on same resource very much if run on one machine, and you can afford the price of other machines, multi-machine would be nice.

    But one thing is sure, mulit-machine programming won't make thing easier. You have to plan very carefully. The real problem for multi-core is almost only about the cache.
    Nope

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: multithreading vs multi-machines?

    In addition to what the other guys have said.

    Multithreaded programming doesn't have to be difficult if you take a RAII approach to synchronization. Most developer run into trouble when sharing data between threads, and find the synchronization of the data difficult.

    Structuring the program property and using RAII makes things relatively simple.

  5. #5
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: multithreading vs multi-machines?

    Multi-Machine is "easier" because you are very well aware of what is happening. When you think a problem through it is ALWAYS easier....

    One other technique for dealing with many of the issues is "immutable objects". In this scenario (heavily used in many of the newest MP libraries), an object NEVER changes state.

    Operations which would have changes an objects state, instead create a new object with the new state. This even goes as far as "containers".

    If you have a list with 10 items in it, and want to remove one, you take the 10 item list as an input, and output a 9 item list as well as a "loose" instance....

    This sounds downright wierd.....until you have used it and realized the power....
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured