Multi-Core Apps?

Discussion in 'Mac Apps and Mac App Store' started by ~Shard~, Sep 1, 2006.

  1. ~Shard~ macrumors P6


    Jun 4, 2003
    So, a relatively straight-forward question. With all these dual core processors out now, and with the likes of Kentsfield coming out in the near future taking advantage of 4 cores on a chip and so forth, I'm curious to know more about how the software developers will respond to this in terms of their applications. Multiple cores are great, but if the applications aren't optimized to take advantage of them, what's the point of having all that extra processing power other than for brute force tasks in professional apps?

    Just curious to hear some thoughts on the matter. :cool:
  2. risc macrumors 68030


    Jul 23, 2004
    Melbourne, Australia
    Macs have had multiple processors for years so there are plenty of smp enabled apps already, and the OS seems to handle everything else really well too. Nothing worth worrying about imho.
  3. ~Shard~ thread starter macrumors P6


    Jun 4, 2003
    Yeah, I guess multiple cores isn't that much different from multiple processors... I'm just thinking that when we eventually get Dunnington, etc. and 32-core chips, are there really going to be apps out there to take advantage of them? Sure, pro apps will at some point, but basic apps could be optimized a lot as well - I guess that's more my question - will they be?

    As a simple (and I'm sure flawed) example, with dual cores, I'd love to see Office for Mac apps run twice as fast. They run 'x' speed on a single core processor, so why not optimize the apps to make them run '2x' when multitasking with 2 cores? ;)
  4. mduser63 macrumors 68040


    Nov 9, 2004
    Salt Lake City, UT
    My thought is that simple apps which don't need a lot of raw CPU power don't really need to take advantage of multiple cores as long as the OS does a good job of load sharing. So if you've got 10 little apps open, if the OS does a good job of distributing each app's processing to a different CPU core, you're fine. For apps (mostly pro apps) that need raw horsepower, they better be multiprocessor aware.
  5. Thomas Harte macrumors 6502

    Nov 30, 2005
    The problem from a software development viewpoint is that to use multiple cores you have to be able to break your code into parts that can be executed non-sequentially. I.e. there need to be parts where you can say "I need to work out the following things, but these items don't depend on the result of those items, those items don't care about some other items, etc"

    Usually that isn't terribly difficult but all the current languages make flagging of separate parts a bit of a hassle. For example, in the traditional C-derived languages you have to explicitly split off a separate thread, do a bunch of stuff in that and then do whatever synchronisation is required to get all your results back together.

    There are a lot of things multithreading is really good for though because there are some things that naturally desynchronise. Most Photoshop filters can be threaded because what they do to a pixel in the top left of the image often has nothing whatsoever to do with the data in the bottom right and vice versa. Little things like the save command in most programs are good candidates too. Duplicate the document state in memory then farm it out to a separate thread to write to the disk. Copying in memory is much faster than copying to disk so the user doesn't have to wait to continue working on their document.

    But as suggested, the main benefit today is in running programs simultaneously. Your computer spends most of its life with lots of different programs running and it is quite easy for a modern OS to split them between different cores. Launch /Applications/Utilities/Activity Monitor and have a look.

    At the minute I have the following running:

    Activity Monitor: 2.60% CPU utilisation, 2 threads
    mdimport: 0.00% CPU utilisation, 4 threads
    iTunes: 8.20% CPU utilitsation, 7 threads
    Adium: 0.10% CPU utilisation, 9 threads
    AppleSpell: 0.00% CPU utilisation, 1 thread
    Mail: 0.00% CPU utilisation, 7 threads
    Safari: 0.00% CPU utilisation, 9 threads
    iTunes Helper: 0.00% CPU utilisation, 1 thread
    Finder: 0.00% CPU utilisation, 3 threads
    SystemUIServer: 0.00% CPU utilisation, 2 threads
    Dock: 0.00% CPU utilisation, 2 threads
    pbs: 0.00% CPU utilisation, 2 threads
    loginwindow: 0.00% CPU utilisation, 3 threads
    ATSServer: 0.00% CPU utilisation, 2 threads

    That is, by my calculations, a total of about 54 threads. Without seeing the internal coding I can't be certain which of those in individual processes can be run simultaneously but there is already a lot of scope for shifting things around between cores should any of the apps actually suddently want more than the total of about 10% CPU that I'm using. I love the Intel transition!
  6. Bear macrumors G3

    Jul 23, 2002
    Sol III - Terra
    For simple applications, enhancing them to use use multiple cores doesn't make much sense really.

    There are already some applications that uses multiple cores well already. And some that can only really take advantage of two cores. And most applications get some ability to run on multiple core just by calling standard system libraries.

    Having a Quad G5, I know that my two heaviest applications can only really make use of 2 cores eacg, however, as I usually have them both doing things at the same time, it's not too bad. Also, remember that if you have one application sucking up two cores, other applications can run on any available core.

    Having said that, I think the Quad G5 was worth it. Anything more than 4 cores wouldn't have gained me much with the software I am currently running.

    Looking at Activity Monitor, I currently have 345 Threads spread across 86 processes. And there are many many times when I have gotten all 4 cores running close to 100%.
  7. Thomas Harte macrumors 6502

    Nov 30, 2005
    Hmm, didn't think of just checking out the CPU tab at the bottom. So I feel stupid, but at least I'm aware that even on my currently very light load of running programs I have 172 threads spread across 47 processes.
  8. ~Shard~ thread starter macrumors P6


    Jun 4, 2003
    Thanks for the insight guys, it's appreciated. Makes a lot of sense. :)

Share This Page