Multi-core goes mainstream, is your app ready?
At one time multi-core processors were limited to high end devices and phones. Now all but the lowest cost devices sport multi-core processors. The proliferation of multi-core devices has reset user expectations when it comes to apps. Stuttering interfaces, momentary pauses and time watching the wait spinner are no longer easily accepted by users. By taking advantage of multi-core processors your app can run smoother, appear faster, and handle long waits and sketchy Wi-Fi better than ever before.
Multi-core devices support true concurrency. This means that certain aspects of your apps (like your user interface) can continue to run and be responsive while other activities (like loading data or performing complex computations) happen in the background. By structuring your apps to keep the interface separate you can make your app “instantly” respond to user input, and avoid herky-jerky stuttering.
In the end, it is not how fast your app actually performs, but how fast your users feel it performs that matter. By strategically using concurrency you can lessen the perceived amount of time your users are waiting, and make your app appear faster. Rather than simply display the wait spinner, try starting out with a page turn animation, or a fade in. A one second animation can make a 2 second wait appear to be a gentile pause rather than a full stop.
Better handling of long waits and sketchy Wi-Fi
Anything that takes more than 2-3 seconds can leave your users thinking your app is not working. When an activity takes some time or is dependent on connectivity that may not respond right away, the advantages of using well written concurrent code on a multi-core device come to the fore-front. By thinking ahead and looking for activities that may take a while to complete, and separating them from the other parts of your application you can better handle waits and problems without making your app appear stuck or crashed.
The move to multi-core also brings with it some potential problems. While many of the above strategies can be implemented on single core devices using multi-threading to give the appearance of multiple things happening at once, multi-threading on a multi-core processor can provide true concurrency. This true concurrency can make the ideas listed above work better. It can, unfortunately, also cause poorly written multi-threaded code to behave badly. Multi-threaded code that takes care to limit access to data to one thread at a time, and avoids deadlocks will work even better in a multi-core environment. But code that depends on the “one thing at a time” nature of a single core to avoid problems can encounter trouble.
Taking full advantage of concurrency on multi-core devices and avoiding the pitfalls requires thinking about how your app can be structured to support concurrency to its best advantage. There are many articles and guides on the web that can help you take advantage of concurrency on multi-core devices in your chosen development environment. Taking some time to look for them and understand what concurrency can do for your app is worth taking a little time. If you are working in Android you can start by taking a look at Multi Thread Coding in Android in the Enterprise Reference Library.