Hi!
This proposition, should be an option in init.txt for CPUs with more then 2 cores.
The idea is for both executing threads, to use the same available in memory data for map.
The idea is DF should not ever freeze lock entire computer, even if one or two of its processes become busy over 100% speed of CPU for noticeable periods of time.
This is not exactly an example for parallell programming, but more like using 2 processes instead of 1 process, which is possible even on 30+ year old UNIX OS through forking. However this opens possibility to have two 1 thread programs running on 2 cores, instead of one 1 thread program running on 1 core of CPU.
Currently, when pathing algorithm strikes (specially on hugest maps with multiple crossing rivers, not to mention hugest caves under),
the game is freezing repetitiously for uncomfortable 30-60 seconds, even on 4ghz CPU. Those freezes are not producing any informative feedback in game's logs.
I checked it out repeatedly. Only repetitious errors are "Connected Component Overflow", "path fail:..." and "...:site walker could not find walkable area" and some single errors like "loop path fail:" or "removed erroneous unit occupancy flag". So, I believe those freezes occur due path-finding algorithm. No sense even bug-reporting it, as those apply only on largest of the maps with crossing rivers and such.
When no connecting path is found, units usually just pause their movement. Even in air with Keas path blocked by doors, as I noticed.
This auto-pausing of units can be exploited, if pathing algorithm is forked into separate process, for asynchronous path-feeding to units. Units can wait a wee, before moving on.
Even, if the path feeding, due changes in map results that units path will become blocked (or conditions for combat arise),
then they can just pause and wait for path to be recalculated.
Removing cpu intensive path-finding algorithm into its own process presents additional programming opportunities:
1. GPU
Path finding algorithm is using a lot of data, but deploys repeatedly same computing instruction set.
The only issue to feed it instead of CPU to GPU would be recursive nature of the algorithm. Older GPU can not allow it.
However latest GPU architectures allows for execution of recursive algorithms.
This demands understanding for GPU programming and modern GPU architectures.
It would be usable, as an optional feature for those having particular GPU cards with particular GPU architectures.
However GPU with its many million of processing units has potential to outperform CPU with its 2/4/8 processing units by scale of 1mln:1 speed.
Imagine heavy computing task performed by CPU in 1.5 minute shortened to barely 3 seconds.
2. ML
Path finding algorithm's process could be, for its performance sake, enhanced with its own Machine Learning algorithm.
This could lead to optimizations in path finding.
It requires understanding of ML algorithm.
A little like people walking through forest repeatedly, are finding same parts of path, so it becomes visible to naked eye. Then they do not need to find it any more. Even, if there is dug out a shortcut (like dwarves digging into a cave) into path, but which is not so visible. Therefore it (like insides of fortress for example by cave beings) is rather ignored by majority of people, who are walking through forest from one end to another.