MenTaLguY wrote:
On Fri, 2008-03-14 at 20:40 +0100, Mihaela wrote:
Multithreading and even distributed computing seem to be the future, something Inkscape will face sooner or later. Since cleanup will be done now it seems natural to incorporate it into the plan (sooner).
It's just not feasible right now. We need to clean up the design and partition things a lot better, so we could make individual portions of the codebase threadsafe. Right now, everything touches everything else, and nothing is threadsafe. The main thing is eliminating tight coupling between subsystems, after which point we can make individual subsystems threaded/threadsafe.
-mental
Yes, separating parts of code into pieces that are as independent as possible is the ground work for multithreading. Isn't that what 0.47 cleanup will (try to) encompass?
There's a thing about multiprocessing to keep in mind here; you don't need to have your entire code cleaned up and threadsafe. I think its fair to say no software can, you always have parts that can be split to work on more than one core, and parts that can't (this part can even be tangled spaghetti code).
It would be worthwhile to analyze the code and see what parts are appropriate for multithreading. Maybe you would only find 2 or 3 such places, but the speed increase on multicore machines could still be very significant.
The expert in multithreading I mentioned might help isnt familiar with Inkscape code and he'd need your input when it came to a specific case, but he thinks that heavy load code segments are potentially the best candidates for multicore implementation:
1. places with large loops 2. heavy maths formulas (matrix included) 3. graphics rendering (depending on its multithreading features)
Some of it will be a complex job, but its inevitable, it must be done and it definitely can be done, with a little bit of lateral thinking and a little bit of effort. As I mentioned before there are many levels of parallelization, it all depends on your features and code design.
In the new version of gcc OpenMP will be implemented (i think its in experimental phase now). With it the parallelization will be much easier, so it would also be very good to implement OpenMP into Inkscape.
If youd be able to find those heavy load segments and apply OpenMP on them, that would be HUGE progress.
The articles on the Intel site are good, you can check it out if you like http://softwarecommunity.intel.com/isn/home/MultiCore.aspx
jon@...18... wrote:
Yes, libraries might give us some unexpected problems. Just in adding the newer tablet support I happened to run across all sorts of things that are in the gtk or gdk headers that appear to be disabled for thread-safe builds.
(I'm hoping that is just legacy defines... but it may be a lurking problem)
Yes this problem needs to be addressed but its not a show stopper; one of the methods you can apply here is to lock the not_thread_safe library so that only one thread can access it.
Anyway, no matter when multicore/distributed processing actually gets implemented, it would be wise to start *planning* for it as soon as possible. As you all know making code threadsafe will only become more complicated as the code gets bigger.