Data races, critical sections, processor loading, Operating System

Assignment Help:

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.


Related Discussions:- Data races, critical sections, processor loading

What is degree of multiprogramming?, What is degree of multiprogramming ? ...

What is degree of multiprogramming ? Degree of multiprogramming signifies the number of processes in memory. If the degree of Multiprogramming is steady after that the average

What is independent process, What is independent process? A process is ...

What is independent process? A process is independent it cannot influence or be affected by the other processes implementing in the system. Any process does not share data with

Interrupt-driven i/o to manage a single serial port, Q. Why might a system ...

Q. Why might a system utilize interrupt-driven I/O to manage a single serial port however polling I/O to manage a front-end processor such as a terminal concentrator? A

Mention some attractive properties of semaphore?, Mention some attractive p...

Mention some attractive properties of semaphore?              The Semaphores aren't provided by hardware. However they have numerous attractive properties: Machine indep

Explain the fork-join, Explain the Fork-join This is primitives in a hi...

Explain the Fork-join This is primitives in a higher level programming language for implementing interacting processes. The syntax is like this: fork ; join ; where

Ipc, Explain in detail about ipc in linux

Explain in detail about ipc in linux

Program that will input an interger target value, When you turn in an assig...

When you turn in an assignment to be graded in this class, you are making the claim that you neither gave nor received assistance on the work you turned in (except, of course, assi

Implementation of modern memory management system , Central to implementati...

Central to implementation of a modern memory management system is the page replacement algorithm. Modern virtual memory systems break memory up into pages and map (via a page table

Explain the worker model, Explain the Worker Model The Worker Model of ...

Explain the Worker Model The Worker Model of client-server application architecture provides a very good understanding of threads and their power to the developer. This exercis

Develop a utility in c programming, Develop a utility in C language which w...

Develop a utility in C language which will run in Linux operating systems to display following properties of the system: ? Processor speed ? Ram size ? Computer name ? System time

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