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?

Producer – consumer process, Step by step displays the content, and the fin...

Step by step displays the content, and the final result of the list ("buffer") of 6 elements as the initial values ??and the following elements which are produced (NEXTP) or consum

What is multiprogramming, Q. What is Multiprogramming? Multiprogrammin...

Q. What is Multiprogramming? Multiprogramming When two or more programs are in memory at the same instance, sharing the processor is referred to multiprogramming opera

Define buffering, Define buffering. A buffer is a memory area that keep...

Define buffering. A buffer is a memory area that keeps data whereas they are transferred among two devices or among a device and an application. Buffering is done for three rea

What is the main advantage of multiprogramming, What is the main advantage ...

What is the main advantage of multiprogramming? Multiprogramming makes efficient use of the CPU by overlapping the demands for the CPU and its I/O devices from various users. I

Gang scheduling , Gang Scheduling : A set of related process is scheduled ...

Gang Scheduling : A set of related process is scheduled to execute on a set of processors at the similar time, on a 1-to-1 basis. Closely related processes or threads may be sched

What is erd, What is ERD? Entity Relationship Diagram is the graphical ...

What is ERD? Entity Relationship Diagram is the graphical representation of the object relationship pair. It is mostly used in database applications.

Modern os, importance of Operating system in modern computers. Also explain...

importance of Operating system in modern computers. Also explain various functions & types of operating systems

Rf, whta is an operating system ? what sorts services are provided by an op...

whta is an operating system ? what sorts services are provided by an operating system ?

Kernel to context switch between kernel level threads, Q. Explain the actio...

Q. Explain the actions taken by a kernel to context switch between kernel level threads. Answer: Context switching among kernel threads classically requires saving the value

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