The next release of QGIS will have multithreaded map rendering, a feature initially added to QGIS Enterprise in late 2013, a customised version of QGIS provided by the Swiss consultancy firm Sourcepole. The code providing multithreaded rendering is now part of the unstable development branch of QGIS, which is now undergoing testing. So what is multithreaded map rendering and does it mean for QGIS?
All modern desktop computers have multicore CPUs, with 4 to 8 processing cores on a single CPU die. In theory, multicore CPUs allow computer code to run in parallel on each processor core resulting in a considerable speed advantage. However, standard computer code does not take advantage of extra processing cores, so called single-threaded code uses one core at a time.
This is because multithreaded computer code has to be explicitly written and compiled in order to take full advantage of modern multicore CPUs. This is no easy task and multithreaded applications remain comparatively rare, generally limited to multimedia, games and computer graphics applications that require CPU intensive calculations.
Computer scientist Martin Dobias, who is adding multithreaded rendering to QGIS explained in a recent interview that the development version of QGIS was initially quite unstable, it often slowed down or even crashed because more than one processor core attempted to access the same data at the same time. In order for multithreaded rendering to work it was necessary to get the CPU cores to work cooperatively rather than competitively.
The current version of QGIS, 2.2 Valmiera, is single threaded. It uses one CPU core when redrawing the map window or when a menus are selected, it cannot multitask within its own application. This typically causes QGIS to become unresponsive while a map redraws when one zooms or pans. This is especially true for large data sets.
However, as seen in the demo video below, the development branch of QGIS 2.3 now has stable multithreaded map rendering. There is a considerable increase in map rendering speed but also significantly, the interface of QGIS remains fully responsive. Furthermore, the already impressive responsiveness will grow proportionate the number of CPUs and cores provided. Imagine QGIS 2.4 running on a modern dual CPU Xeon workstation, with up to 24 CPU cores and 48 processor threads. This is just a taste of what to expect in QGIS 2.4 which is due for release on the 20th of June.
Note: This article was edited to include the recent interview of Martin Dobias by Tim Sutton.