There’s a lot of excitement at the moment around MeeGo, the cross-platform Linux-variant that is being championed by Intel, Orange and many others. Intel has opened an app store for MeeGo, which signals the start of MeeGo as a commercial proposition for developers. Intel’s also running a competition to reward the developer of the most elegant MeeGo app with a supersonic flight in Russia, as well as offering cash incentives to publish MeeGo apps through the Intel AppUp developer program.
So it’s a good time to find a tutorial on parallel programming for MeeGo. The Qt framework used to create MeeGo apps offers parallel programmers:
- QThreads, enabling you to create OS-level threads without needing to worry about the underlying implementation.
- QtConcurrent, used to create a thread pool for queuing up parallel tasks without creating a new thread for each task. The number of threads created is determined by Qt depending on the hardware available (number of cores and threads the hardware presents).
- QThreadPool, which underlies QtConcurrent and which can be manipulated directly to control the number of system threads created and the scheduling algorithm.
- QFuture, used to store the output of a thread which might not be available yet. If it’s not available when required, the program will wait until its value is made available.
- QMutex, used for locking shared resources to avoid data races.
- Qt Collections, which enable a batch of data to be processed in parallel, implemented by QtConcurrent and giving a single QFuture object that shows whether the operations have completed.
Perhaps the best way to follow how they work is to see them in source code, so read the full tutorial for code examples and more documentation. Over time, the number of cores available on hardware is only going to increase, and the vision for MeeGo will take it into lots of different devices, so by preparing to take your software multicore today, you can reap performance benefits in future and position yourself to create the next generation of multithreaded apps. You can also squeeze the best performance from today’s netbooks to create apps that wow users and sell in volume.