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 are the functions of virtual file system (vfs), What are the functions...

What are the functions of virtual file system (VFS)? a. It separates file-system-generic operations from their execution defining a clean VFS interface. It permits transparent

Timers could be utilized to compute the current time, Q. Timers could be ut...

Q. Timers could be utilized to compute the current time. Provide a little description of how this could be accomplished. Answer: A program could utilize the following ap

Write a brief note on demand paging, Write a brief note on demand paging. ...

Write a brief note on demand paging. A demand paging is alike to a paging system with swapping. The Processes reside on the secondary memory while we want to implement a proces

What is a multiprocessing system, What is a multiprocessing system? Mul...

What is a multiprocessing system? Multiprocessor systems are those systems that use additional than a single processor for program execution. It is done for raising the executi

Benefits of dynamic linkage of libraries, Q. What are three benefits of dyn...

Q. What are three benefits of dynamic (shared) linkage of libraries compared to static linkage? What are two situations where static linkage is preferable? Answer: The

Dynamic memory management, Usually memory is allocated from a large pool of...

Usually memory is allocated from a large pool of unused memory area called the heap. In C++, dynamic allocation/deallocation must be manually performed using commands like malloc,

What is the use of inter process communication, What is the use of inter pr...

What is the use of inter process communication. Inter process communication gives a mechanism to allow the co-operating process to communicate with each other and synchronies t

Address operator and pointers, We are use to using variables within C witho...

We are use to using variables within C without thinking about where they are stored. Most variables are dynamic i.e. can change, therefore they are stored in Ram, unlike a program

Explain important fuction of virtual file system, Virtual File System serve...

Virtual File System serves two important functions. 1. It divides file-system-generic operations from their execution by defining a clean VFS interface. 2. The VFS is based

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