Avoid race conditions in multithreaded tasks, and normalize tasks.