topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 3:46 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Multi-threaded software  (Read 6982 times)

azza

  • Supporting Member
  • Joined in 2005
  • **
  • Posts: 12
    • View Profile
    • Donate to Member
Multi-threaded software
« on: July 30, 2008, 07:56 AM »
I've just upgraded to a multi-core processor (Intel Quad Core) for the first time.
Until now I haven't been concerned whether an application is multi-threaded or not.   Now all of a sudden I'd prefer multi-threaded applications if possible (most of the time my current applications only use one core, and my multi-threaded Java test programs just don't cut the mustard.  I mean how many times can you watch the Dining Philosophers problem being solved? ;)
Anyway my question is, does anybody know of a list of multi-threaded applications I might use to take advantage of all my new processing power.
If not, we should start one!

ChalkTrauma

  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 116
  • ::41554D::
    • View Profile
    • DreamCycle Studios
    • Donate to Member
Re: Multi-threaded software
« Reply #1 on: July 30, 2008, 09:47 AM »
There is a really good article over at CodingHorror.. It is a bit old, but still very relevant Quad Core Desktops and Diminishing Returns
'Behold! It is not over unknown seas but back over well-known years that your quest must go; back to the bright strange things of infancy and the quick sun-drenched glimpses of magic that old scenes brought to wide young eyes.'

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Multi-threaded software
« Reply #2 on: July 30, 2008, 10:00 AM »
I think f0dder will be a good person to comment on this -- but since a modern operating system like windows runs so many different processes at the same time -- you are going to benefit significantly from a multi-core cpu even with single-threaded applications because other processes can run on the other cores.

so that except for certain very processor intensive operations (video encoding, compressing/decompressing, heavy duty statistics), having a single application which is able to capitalize all the cores of your cpu simultaneously seems unnecessary to me.

but i'm not an expert, let's hear what the people who know about such things have to say.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Multi-threaded software
« Reply #3 on: July 30, 2008, 12:57 PM »
You benefit greatly from going single->dualcore, but not so much from dual->quad. Not yet, anyway. It hasn't been my experience that the system on a whole feels smoother with a quadcore for daily use. But yet, it does mean you can run multiple intensive single-threaded applications more efficiently, and it helps with virtualization. Also, some games have started utilizing two cores fairly efficiently, so even while a quadcore might not help a game that much (yet), it gives you more breathing room to have other background stuff running.

Every now and then, I delete a bunch of albums from my 8gig flash based MP3 player, and need a fresh crop of MP3s for it. I archive my audio CDs in FLAC format, and then transcode to MP3 for the player... the quadcore goodness helps a lot here.

Also, when compiling larger projects, it's nice having multiple instances of cl.exe running - cuts down time.

And the upcoming games are supposed to be more efficient at utilizing more cores, at least companies like Valve have been putting a lot of effort into threading their code.
- carpe noctem

azza

  • Supporting Member
  • Joined in 2005
  • **
  • Posts: 12
    • View Profile
    • Donate to Member
Re: Multi-threaded software
« Reply #4 on: July 30, 2008, 04:08 PM »
To clarify, I was thinking of CPU intensive software.
eg.  Graphics & video editors, format transcoders, maybe virus checkers and the like.
I presume most of the newer software (especially commercial software perhaps) in these categories is multi-threaded, but nowhere have a seen an actual list to confirm which ones are.
Short of it being documented I guess you could just check your CPU usage to see if multiple cores were being used when the software is running, but a list somewhere would still be handy!

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Multi-threaded software
« Reply #5 on: July 30, 2008, 04:44 PM »
Right now, I can't confirm this, but I'm pretty sure that a program being multi-threaded doesn't directly imply that it will run on 2 cores at the same time.
For this to happen, it needs to be programmed in something like OpenMP.
Still, one single application rarelly has the expected benefits from running in 2 processors, by Amdahl's law, which proves that if you have a serial part in your program (which all programs usually have), the speedup you get by adding more processors is severely limited (see the graph on the page to get a better idea).

So, like mouser mentioned, the best benefit is when you run several concurrent applications.

PS: I'm on vacations and can't test what I mentioned in the beggining of the post. Could someone just make a multithreaded app in C++ or Java or something and check if both cores are used? thanks

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Multi-threaded software
« Reply #6 on: July 30, 2008, 04:56 PM »
Multithreaded does mean you run on several cores (well, generally), but it doesn't necessarily mean you get much advantage from it - ie., if you have threads that's mostly asleep, for instance. And you obviously do need to create multiple threads first, just (for instance) linking against multi-threaded C runtime doesn't really help ;).

For typical CPU-intensive stuff, it can be a pain parallelize your algorithms. OpenMP and compiler support can help, but I dunno how well it works - you still need to think yourself, and add hints for the compiler.

For stuff like internet servers, the situation is probably a bit easier (set up a thread pool and handle clients from that), but still not exactly trivial - you need to consider race conditions, deadlocks, synchronizing access to shared state, et cetera.

But this is drifting away from the topic of listing software that has efficient use :)
- carpe noctem

Lutz_

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 229
    • View Profile
    • Donate to Member
16 core example
« Reply #7 on: July 30, 2008, 05:13 PM »
Some programs certainly will make better use of multi-core cups than others. The RAW converter Bibble is certainly proud of the multithreading performance in their coming version 5.   They have a video there showing efficient 16 core usage.

http://bibblelabs.co...s/bibble5/b5-16wide/

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Multi-threaded software
« Reply #8 on: July 30, 2008, 05:23 PM »
Some programs certainly will make better use of multi-core cups than others. The RAW converter Bibble is certainly proud of the multithreading performance in their coming version 5.   They have a video there showing efficient 16 core usage.

http://bibblelabs.co...s/bibble5/b5-16wide/
That probably has quite a coding advantage, though: "I converted 116 RAW images from a Canon 1D Mark 2 dSLR from RAW to JPEG in about 1/12th the time of other software running on the same machine." - even if they haven't got the algorithms themselves multi-threaded, they can just launch 16 worker threads each processing a file at a time. (OK, disk I/O is still something you need to handle efficiently to avoid thrashing, but still...)
- carpe noctem

azza

  • Supporting Member
  • Joined in 2005
  • **
  • Posts: 12
    • View Profile
    • Donate to Member
Re: Multi-threaded software
« Reply #9 on: July 30, 2008, 07:50 PM »
In terms of performance gains from multi-threaded applications, there is a performance hit from synchronization of shared data sources between multiple threads.  So if you have different threads working on the same data structure you won't see twice the performance from a 2 threaded application.  Obviously it depends how heavily the application will be working with these shared data sources as to how much of a performance hit there is.
However if the application is working on distinct sets of data (for example different .mp3 files) then a doubling of performance is relatively easy to achieve, subject to other bottlenecks in the system.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Multi-threaded software
« Reply #10 on: July 30, 2008, 07:56 PM »
Also, it's worth nothing that you can sometimes reduce amount of synchronization necessary through lock-free algorithms. You better know very well what you're doing, though, or use some prefab libraries. There's lot of nasty little subtleties that can go unhatched until you get some freak borderline situation...

Software Transactional Memory also sounds pretty interesting, but...
- carpe noctem