What are race conditions?, Operating System

Assignment Help:

What are race conditions?

Race conditions are problems that take place due to the sharing of the same file by several processes. In such a case none of the processes is able to use the shared file. Consider the illustration of a printing queue that maintains the list of all files to be printed. As well consider a file shared by two processes PA and PB.

1266_What are race conditions.png

The file has obtained two variables:

                    ‘in’ pointing to the next free slot (N.F.S)                     

and

          ‘out’ pointing to the next job to be executed.       

    

   Primarily in the file, in=7 and out=4. Let PA be the first process that uses the file. Then PA sets its local variable N.F.S=7. However before placing into the queue, an interrupt occurs. At present PB comes. PB also sets its local variable N.F.S=7 and is placed in the queue.

Then N.F.S=N.F.S+1 which sets in=8. In such a case while implementing PA overwrites the slot 7 that is already occupied by PB. Thus nothing will be printed. Such a condition is an example for race condition.

 

The file has obtained two variables:

                        'in' pointing to the next free slot (N.F.S)                     

and

          'out' pointing to the next job to be executed.     

 

Primarily in the file, in=7 and out=4. Let PA be the first process that uses the file. Then PA sets its local variable N.F.S=7. However before placing into the queue, an interrupt occurs. At present PB comes. PB also sets its local variable N.F.S=7 and is placed in the queue.

Then N.F.S=N.F.S+1 which sets in=8. In such a case while implementing PA overwrites the slot 7 that is already occupied by PB. Thus nothing will be printed. Such a condition is an example for race condition.


Related Discussions:- What are race conditions?

Typical virtual memory layout, Using pages makes it easier to manage the wh...

Using pages makes it easier to manage the whole memory, avoiding excessive fragmentation and waste. As an analogy, think of Tetris, but with only square blocks: it is relatively ea

Explain external fragmentation?, Explain external fragmentation? Extern...

Explain external fragmentation? External fragmentation is the process where the free space and the space still available for use, in a piece of storage become separated into ma

Define a layer that is not of an io management module, Define a layer that ...

Define a layer that is not of an IO management module  MCS that is Management Control System is not of an IO management module

How are file sharing and protection implemented, How are file sharing and p...

How are file sharing and protection implemented? To execute file sharing and protection the system have to maintain more file and directory attributes than are needed on a sing

Monolithic, What is monolithic and its diagram

What is monolithic and its diagram

Operation managmant, what is the function of operation management?

what is the function of operation management?

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd