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?

What is the output level at which 5z company break even, The 5Z Company is ...

The 5Z Company is selling pens to the local market. It is planning to maximize sales and profit by analyzing few conditions using the break-even analysis formula. Below is the data

Define field that contain segment index or an internal index, The field tha...

The field that consists of a segment index or an internal index is known as Target datum is field that consists of a segment index or an internal index.

Explain message passing system, Message passing system:- The function o...

Message passing system:- The function of message system is to permit processes to communicate with one another without the requirement to resort (option) to shared data. Commun

Os structures, #question.explain varios types of system calls..

#question.explain varios types of system calls..

Explain advantages and inconveniences of ult, ADVANTAGES AND INCONVENIENCES...

ADVANTAGES AND INCONVENIENCES OF ULT Advantages: Thread switching doesn't involve the kernel - no mode switching Scheduling is able to be application specific -

Need of shift alteration in critical section problem?, Explain with an exam...

Explain with an example the need of Shift Alteration in critical section problem? Consider processes P i and P j and consider the algorithm for P i and P j .

Search and print between two words/patterns, what if we need the portion fr...

what if we need the portion from a text based on some keyword. For eg. My file is like below, ------------------------------------------------ Order=[ 1 2 3 4 5 Order=[ 6 7 8 9

Explain the proper distribution of functionality and code, Explain the Prop...

Explain the Proper Distribution of Functionality and Code It is important to note that the bandwidth of the server operating system and server processor availability is fixed.

Describe demand-paged environment, Q. Which of the subsequent programming ...

Q. Which of the subsequent programming techniques and structures are good for a demand-paged environment? Which aren't good? Describe your answers. a. Stack b. Hashed symbol

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