7 ms·
My misadventures with multi core programming tell me that there is zero demand for multicore application development. Although I have experienced that the vast
by imtringued 6y ago
My misadventures with multi core programming tell me that there is zero demand for multicore application development.
Although I have experienced that the vast, vast majority of problems can be divided to run on multiple cores, assuming you have enough work for the cores. There was a problem where I convinced myself it could not be done without locking and a complicated transaction scheme but I still somehow managed to turn the problem into a data parallel algorithm. The code is extremely counterintuitive, error prone and both hard to write and read.
However, writing a purely parallel application is so much work even for an expert that there is a huge productivity drop in many cases and for non experts a lot of the problems are intractable, so it is only done when absolutely necessary.
So my general strategy has been to significantly relax maximum possible parallelism in exchange for the ability to pretend that your code is single threaded. The general idea is quite simple. Split your data into smaller segments. If a segment accesses another segment merge the two into a big segment. Then process each segment as if it was single threaded but you can process independent segments in parallel.
The big problem with this approach are pathological cases where you get very large segments.
One (fictional) example would be a simulation involving long distance transport. Train stations that are connected with rails form a very huge graph of segments consisting of dozens of train stations. However, airports are not connected so each airport can still be simulated in parallel and if you have multiple rail networks you can simulate each on a separate core.
It's far faster than staying purely single threaded but it means that you will always be bottlenecked by your slowest core and that means current ARM offerings will be behind unless you are doing something extremely multi core intensive like video encoding which will gobble up as many cores as you have.