Stop Waiting with Concurrency
No matter how fast we make our processors run, "wait cursors" seem to be a much too common occurrence. Windows users usually see wait cursors as spinning hour glasses. It turns out that processor speed is not the solution for this problem, but fortunately, parallelism is.
| Read Alexa Weber Morales' counter to this article. |
It is time to put an end to wait cursors and other "please wait" indicators telling us that the user interface is completely unavailable on a system or in an application. I cannot overemphasize how strongly I feel about fixing this flaw in computers. The good news is, parallelism makes this possible to do by design. With the right design, we can see benefits with dual-core and expect to see improvements each time the number of cores increase until there are no more wait cursors!
Tabbing: Firefox Beats Internet Explorer
I spend a lot of my time in Web browsers, waiting. My favorite feature in browsers is tabs. I'm addicted. I use control-click over and over on links to open lots of tabs. Firefox is much better at letting me do this than Internet Explorer, because Firefox is available for more mouse clicks almost immediately after I use control-click on a link. Microsoft's browser, on the other hand, is designed in such a way that it stalls for too long to make my use of it comfortable. I tried out Safari as well. Safari on Windows, despite having plenty of "version 1.0" issues that prevent me from relying on it, is as good as Firefox in letting me control-click for tabs with reckless abandon.
Yet, all three browsers use wait cursors too much. After asking for many tabs to be opened, the user interface slows. The scroll bars stop working, even on tabs with all the content loaded, and menu items freeze up. Clicking to switch from tab to tab does not result in an immediate redraw, regardless of whether content is loaded or not. How much of this is the windowing system and how much of it is the application? I don't care.
Parallelism: Stomping Out Wait Cursors
Imagine designing a browser, or any application, where the user interface never waits. When the user requests something, another thread is given the work to do and the user interface continues to be responsive. If a repaint operation is needed, it is done immediately based on the most recently available data. If a menu option is desired, the options drop down and can be clicked upon. If something is pending, it is obvious what is pending and the wait is user-friendly. When something is completely impossible to offer as an option, the option is grayed out and a mouse over will cause a small pop-up explaining why the feature is temporarily unavailable. If stale data is displayed, it is still displayed with some intuitive way to convey that new data is coming. If a page is loading, instead of a blank white page, the old page is still faintly readable but obviously about to be replaced. When new content is refreshed into view, it is done smoothly, like a page turning or something else which is visually obvious.
All this is possible with parallelism. The keys are:
- Never let the user interface thread do anything that can block other work.
- Use additional worker threads to get any blocking work done.
- Never let key data needed by the user interface become unavailable.
The third point requires rethinking data structures. Instead of offering nothing to display while a new page is loaded, imagine always having a page to display even when a page is loading.
When we program this way, we will end up with a great user interface, worker threads to use parallelism and accessible data structures that avoid contention.
Let's design with the user in mind; let's eliminate the crutch of wait cursors. And, before this causes a rush on grayed-out buttons, let me suggest that graying out buttons be used as a last resort. If you do use them, come up with a plan to reduce your reliance on them over time. With no waiting as a user experience goal, we can see lots of improvements from parallelism.
Browsers, Microsoft Word and Microsoft Office
I focused on browsers because I could at least see hope in Firefox and Safari toward using parallelism wellsomething I do not see in Internet Explorer as a user.
That said, I depend on Microsoft Word and Microsoft Office heavily. My experience says that the Microsoft Word team has really focused on these key issues. They slipped spelling and grammar checking into the background, as well as using threads to update change tracking bubbles on the side of the screen. When I'm typing changes in a complicated document, Microsoft Word remains responsive to my input even if the display updates lag, such as the change-tracking on the side of the text, repaging, and other formatting adjustments. Likewise, the spelling checker and grammar checker will lag a bit at warning me of my errors if I'm typing fast enough. And printing stopped being a bottleneck years ago, a feature I still love in Microsoft Word (background printing).
Hats off to the Microsoft Word team; I'm impressed. My only request would be that someone from the Word team go visit the Microsoft Office team. Microsoft Outlook freezes completely solid frequently for me while waiting for HTML downloads to preview e-mail or updates from the mail servers. Outlook definitely has key data structures go offline from the user interface far too often. Too many "highly contended locks," to put it in terms of parallel programming. I had hoped Office 2007 would make everything better, but there is still a large gap between the responsive Microsoft Word, and the frequently freezing Microsoft Office. They are worth comparing to think about this issue, as much as comparing Firefox and Internet Explorer. These are solvable problems that require consideration at a design level in the applications.
No More Wait Cursors
I dare to imagine a world without wait cursors. This is one benefit of parallelism, and it cannot come too soon.
This Week's Multicore Reading List
MATLAB and Google App Engine
Logging In C++ : Part 2
Improving log granularityA Conversation with BitMagic's Developer
Prefer Structured Lifetimes: Local, Nested, Bounded, Deterministic
- Intel Parallel Studio; Download the free eval today!
- Parallelism Breakthrough Video Series; Watch and learn more about Intel® Parallel Studio
- 2009 Intel Software Webinar Series; View On-Demand webinars
- Coding for Multi-core Processes; Intel® Compiler Pro eBook
- Performance Through Parallelism; Intel® Tuning for Vista eBook
- Intel® Software Network; Connect with developers and Intel engineers
-
November 17, 2009
Visual Effects for Animation - presented by DreamWorks Animation
Speaker: Ron Henderson (Bio)Ron Henderson manages the FX Tools group at DreamWorks Animation, where he is responsible for developing physical simulation and procedural modeling tools. These systems have been used for key visual effects in recent films such as Kung Fu Panda and Monsters vs. Aliens (March 2009).
Prior to joining DreamWorks in 2002 he was a senior scientist at Caltech with a joint appointment to the Applied Math and Aeronautics departments, where he worked on efficient techniques for the direct numerical simulation of fluid turbulence.Abstract:
In this webinar, Ron Henderson will show examples of visual effects, from hair and feathers to smoke and fire, from a variety of DreamWorks Animation feature films. He will discuss in general terms the kinds of techniques used to achieve particular visual effects. Finally, Henderson will show a detailed breakdown of the dam-breaking scene from Madagascar: Escape 2 Africa, demonstrating how different elements of key frame animation, simulation, and rendering are combined in a real production shot. -
December 1, 2009
A Quick and Easy Way to Parallelize a Legacy Codebase with Intel® Threading Building Blocks (TBBs)
Speaker: Bernard Laberge, Avid, Senior Principal Engineer (Bio)Bernard Laberge is a senior principal engineer in the video editors division at Avid. During his seven years with the company he has been actively involved in the replacement of the legacy video processing engines used by Avid editors with a common hardware-abstracted, component-based video processing engine currently running on the CPU with SIMD optimized code, GPU, and dedicated hardware.
Abstract:
Learn how to overcome the limitations of a thread-based scheduler, including dealing with the absence of recursive parallelism support and the inefficient handling of unbalanced processing load. Bernard Laberge addresses how Avid resolved the expensive refactoring of their thread-based scheduler into a task-based solution by choosing Intel® Threading Building Blocks (TBBs). He explores how Avid was able to easily integrate the Intel TBBs into their video editor applications and more than 5 million lines of code. -
December 15, 2009
How to Use Intel® Parallel Studio to Streamline Code Development in a Multicore Environment
Speaker: Matt Dunbar, Director for Performance Technology, SIMULIA (Bio)Matt Dunbar is the director for performance technology at SIMULIA. Since joining the company in 1993, he has worked on parallelization of the Abaqus suite of products, initially for shared memory architectures and more recently for distributed memory architectures. Dunbar has also been intimately involved in selecting both the hardware and software tools used in the development of the Abaqus product line.
Abstract:
Resolve elusive, costly multithreading errors quickly and efficiently with Intel® Parallel Studio. While many coding problems that lead to bugs in software applications are typically straightforward logic errors, errors in managing memory and in multithreading code can sometimes take weeks to months to diagnose and fix. Matt Dunbar explores how and why taking advantage of multicore processors through multithreaded code is critical for compute-intensive applications. While spotlighting his work on SIMULIA's Abaqus finite element solver, Dunbar addresses the need for multicore execution and shares his experiences using Intel Parallel Studio to streamline code development in a multicore environment.



