Data races, critical sections, processor loading, Operating System

Research the phenomenon of data races. Give an example of how an unprotected data race can give rise to data inconsistency. How do OpenMP and Cilk resolve this problem?

Data race is that situation or condition in which multiple threads, without intervening synchronization, try to access the same memory location, with at least one thread performing a write operation. For eg. many data races occur on numerical algorithms owing to chaotic relaxation and asynchronous iterative methods. Also, there are systems where synchronized threads or processes maintain probabilities with best-estimate-matrix and may race with one other to provide updates.This is usually described in higher-level language specs by the phrase: "undefined behavior." A data race could legitimately reprogram the BIOS delete data from the disk and may also stop the processor's fan leading to a multi-core meltdown. 

example code:

 

int checker = 0;

int counts = 0;

Lock lock;

 

bool TryEnter() {

    if (checker == /* get thread id */) {

        counts += 1;

        return true;

    }

 

    if (lock.TryEnter()) {

        checker = /* get thread id */;

        return true;

    }

    return false;

}

 

void Exit() {

    if (counts != 0) {

        counts -= 1;

        return;

    }

    checker = 0;

    lock.Exit();

}

 

the compiler or the processor may “optimize” this program as:

 

void Exit() {

    if (counts != 0) {

        counts -= 1;

        return;

    }

    checker = 42;

    checker = 0;

    lock.Exit();

} 

The effect of this is perhaps not observable in the current thread, nor is it observable by other threads in the absence of data races. Here, the unfortunate thread whose ID is 42 might observe this value and take the ignite the mistake. 

OpenMP and Cilk resolve data racing through a technique known as Data parallelism.It focuses on distributing the data across different parallel computing nodes. This is achieved when each processor performs the same task on different pieces of distributed data. In some situations, a single execution thread controls operations on all pieces of data. In others, individual threads control the operation, but they execute the same code.

Posted Date: 6/29/2012 2:09:57 AM | Location : United States







Related Discussions:- Data races, critical sections, processor loading, Assignment Help, Ask Question on Data races, critical sections, processor loading, Get Answer, Expert's Help, Data races, critical sections, processor loading Discussions

Write discussion on Data races, critical sections, processor loading
Your posts are moderated
Related Questions
Q. How is the NTFS namespace planned? Explain. Answer: The NTFS namespace is prearranged as a hierarchy of directories where every directory uses a B+ tree data structure to

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 are the requirements for solution of critical section problems? Mutual exclusion : If process p is implementing in its critical section then no other processes can be exe

What is contiguous allocation? Allocation of a group of consecutive sectors for a one file.

Explain the ExitThread Function used in the Windows NT ExitThread(ExitCode) The ExitThread( ) call is made to end the currently running thread. If the current thread is th

Define Enforcing Modularity for C Additionally, in C it is sometimes necessary to create modularity of design. C++  is very natural model for component based application design

People arrive at a barber shop at the rate of one every 4.5 minutes. If the shop is full (it can hold five people altogether), 30% of the potential customers leave and come back i

Q. Explain the booting process for a Windows XP system? Answer: (1) Since the hardware powers on the BIOS begins executing From ROMand loads as well as executes the bootstrap

Front page We need to continue or customization and documentation of our system. Currently our system boots into runlevel 5 and we need it to boot into runlevel 3. For future r

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