Before I start, let me recommend you to go to
http://www.coldplay.com/ (the
site of the band Coldplay) and download their new record ("Left Right Left
Right Left"), which is only available today for download (and free-of-charge).
I downloaded it and listened to it and it's great. You need to have JavaScript
enabled to fill the form.
Now back on topic: I branched Freecell Solver to the branch:
{{{
solving-using-several-instances-in-different-pthreads
}}}
And started working on a version of the range solver that spawns several
system threads, creates a solver instance in each one, and handle the
individual deals in the range in a round robin fashion between the threads. I
used the pthreads API, which is Linux's native threading API to implement it.
This will not work on MS-Windows out of the box (at least not without
http://sourceware.org/pthreads-win32/ )
Anyway, I finished and perfected the program today, and benchmarked it? The
results are that with 3 worker threads, and "-r --fc-only", it completes the
MS-32K boards at 115.049045085907 seconds ( 278 deals / second) , whereas the
serial range solver solves them at 132.314429998398 seconds. I'm using a
Pentium 4 2.4 GHz machine (so-called "hyperthreading") with 2.5 GB RAM + 1 GB
of swap.
These are spectacular results, and certainly justified the relatively small
amount of effort that I invested in working on that version of the solver.
I don't have a good explanation for why the thread-enabled version performed
so much better - maybe it was because of the hyper-threading, or because the
program grabbed more attention from the CPU, but it's still encouraging.
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Parody on "The Fountainhead" - http://xrl.us/bjria
God gave us two eyes and ten fingers so we will type five times as much as we
read.
Received on Fri May 15 2009 - 05:24:57 IDT