Category: 

What is a Race Condition?

Article Details
  • Written By: Malcolm Tatum
  • Edited By: Bronwyn Harris
  • Last Modified Date: 14 September 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
In late 19th-century London, mail was delivered to residential addresses up to twelve times each day.   more...

September 28 ,  1924 :  Two US military planes complete the first flights around the world.  more...

Race conditions have to do with attempts by a system or individual device to engage in multitasking. Generally, a race condition exists when the system is attempting to process two or more different operations simultaneously, but is unable to do so. The reason for the failure is that the operations are not lined up in the proper sequence, a circumstance can lead to the system shutting down.

While many different devices are configured to allow multitasking, there is still an internal process that creates a hierarchy of functions. In order for certain functions to take place, other functions must occur beforehand. While the end user perceives that all the functions may appear to be taking place at the same time, this is not necessarily the case.

Ad

A race condition is created when two or more operations are vying with each other to reach completion ahead of the other operations. When all the individual functions are properly arranged, this leads to the successful execution of all the functions in a timely manner. However, if the sequence of operations is thrown out of balance, this creates a bottleneck. In the worse case scenario, the race condition will make it impossible for the system to continue in its attempt to process all the functions in the order currently engaged. Because the system may need to process the fifth function in the string before the first and second functions can be completed, the entire string must be aborted and re-established in the proper order.

One common example of a race condition has to do with the processing of data. If a system receives commands to read existing data while writing new data, this can lead to a conflict that causes the system to shut down in some manner. The system may display some type of error message if the amount of data being processed placed an undue strain on available resources, or the system may simply shut down. When this happens, it is usually a good idea to reboot the system and begin the sequence again. If the amount of data being processed is considerable, it may be better to allow the assimilation of the new data to be completed before attempting to read any of the currently stored data.

Many systems avoid the potential for a race condition by setting priorities in the operational protocols. The priorities are established to function well within the capabilities of the system and thus limit the ability of a race condition to develop.

Ad

You might also Like

Recommended

Discuss this Article

GigaGold
Post 3

Race conditions exist in Real Time Strategy games and skilled gamers know the correct sequence of operations needed in order to defeat an enemy. Two players are literally racing to get the correct things done in the correct order to destroy the opponent, and the effect is like a massive game of chess. Thinking on the fly is also important, as a knowledge and assessment of the psychology of the opponent comes into effect. Research into the game theory behind Real Time Strategy games would make a great Senior Thesis Project.

anon67375
Post 1

Great article. It helped me a lot. Thanks for posting.

Post your comments

exception 'Exception' with message 'error writing captcha: Duplicate entry '2147483647' for key 'PRIMARY'' in /ssd/www/wisegeek/public_html/_core/classes/public/Captcha.php:44
Stack trace:
#0 /ssd/www/wisegeek/public_html/_core/controls/public/ControlDiscussionPostBox.php(324): Captcha->createCaptcha()
#1 /ssd/www/wisegeek/public_html/framework/classes/Control.php(104): ControlDiscussionPostBox->preRender(false)
#2 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): Control->render()
#3 /ssd/www/wisegeek/public_html/tpl/default-nocustom-lu/pages/public/article/article.htm(526): Control->__toString()
#4 /ssd/www/wisegeek/public_html/framework/classes/Control.php(300): require('/ssd/www/wisege...')
#5 /ssd/www/wisegeek/public_html/framework/classes/Control.php(309): Control->requireTpl('pages/public/ar...', Object(PageArticleCom), true)
#6 /ssd/www/wisegeek/public_html/framework/classes/Control.php(131): Control->renderTpl('pages/public/ar...', Object(PageArticleCom))
#7 /ssd/www/wisegeek/public_html/framework/classes/FormDataControl.php(87): Control->renderTemplate()
#8 /ssd/www/wisegeek/public_html/framework/classes/Control.php(109): FormDataControl->renderTemplate()
#9 /ssd/www/wisegeek/public_html/framework/classes/ScriptPage.php(50): Control->render(false)
#10 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): ScriptPage->render()
#11 /ssd/www/wisegeek/public_html/framework/classes/Page.php(97): Control->__toString()
#12 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(443): Page->processRequest()
#13 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(7): PublicFrontController->renderPage()
#14 /ssd/www/wisegeek/public_html/index.php(11): PublicFrontController::run()
#15 {main}