Eraser: A Dynamic Data Race Detector for Multithreaded Programs, Papers of Computer Science

Eraser is a dynamic data race detector for multithreaded programs that uses lockset algorithms to detect potential data races. It assumes lock-based synchronization and checks that all shared-memory accesses follow a consistent locking discipline. The lockset algorithm, its application, and three problematic practices related to data races. Eraser is implemented by automatically instrumenting the program binary with calls to the eraser runtime.

Typology: Papers

Pre 2010

Uploaded on 07/28/2009

koofers-user-bx0
koofers-user-bx0 ๐Ÿ‡บ๐Ÿ‡ธ

9 documents

1 / 18

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Eraser: A Dynamic Data Race Detector for
Multithreaded Programs (Savage et al., 1997)
Presented by Scott Fleming
A Paper Presentation for
CSE 891 - Formal Methods in Software Development: Reliable
Computing With Threads
Fall Semester, 2008
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Eraser: A Dynamic Data Race Detector for Multithreaded Programs and more Papers Computer Science in PDF only on Docsity!

Eraser: A Dynamic Data Race Detector for

Multithreaded Programs (Savage et al., 1997)

Presented by Scott Fleming

A Paper Presentation for CSE 891 - Formal Methods in Software Development: Reliable Computing With Threads Fall Semester, 2008

What Does Eraser Do?

Function: Dynamically detects the occurrence of data races in multithreaded programs

Data race: Occurs when ๎€Š (^) two or more threads concurrently access the same memory location, ๎€Š (^) at least one of the threads is writing, and ๎€Š (^) no explicit mechanism is used to prevent the accesses from being simultaneous

Dynamic detection: Detects as program executes ๎€Š (^) Occurrence of data race depends on what code is executed ๎€Œ (^) Therefore, may depend on thread schedule ๎€Š (^) May miss potential data races

Producer-Consumer with General Race

Producer Consumer

<> BoundedBuffer

q : Queue

empty() : Boolean full() : Boolean push(item : T) pull() : T

q.enqueue(item); for (;;) { if (!buf->full()) buf->push(produce()); }

How Does Eraser Do It?

Assumes: Lock-based synchronization

Approach: Checks that all shared-memory accesses follow a consistent locking discipline

Lock: Primitive synchronization object used for mutual exclusion (also called a mutex ) ๎€Š (^) States: available or owned (by a thread) ๎€Š (^) Operations: (atomic) lock and unlock

Locking discipline: Protocol of lock acquisition and release to prevent data races

Example Application of Lockset Algorithm

t1 t2 locks_held(t1) locks_held(t2) C(v) { } { } { l1, l2 } lock(l1) { l1 } ++v { l1 } unlock(l1) { } lock(l2) { l2 } ++v { } unlock(l2) { }

Three Problematic Practices

Initialization: Shared variables initialized without locking

Read-shared data: Shared constant variables

Read-write locks: Read-write locks allow multiple readers to access a shared variable, but allow only one writer

Solution to Read-Shared Data Problem

Only report races after an initialized variable has been written

State Transitions of a Shared Variable

Virgin

Shared

Exclusive

Shared- Modified

read/write, 1st thread write

read, new thread

read

write

write, new thread

read/write

Example of R/W Lock Problem

t1 t2 locks_held(t1) locks_held(t2) C(v) { } { } { l1 } rdlock(l1) { l1 } rdlock(l1) { l1 } ++v { l1 } unlock(l1) { } read(v) { l1 } unlock(l1) { }

Solution to Read-Write Locks Problem

Require that for each variable v , ๎€Š (^) some lock l protects v , and ๎€Š (^) l is held in some mode for every read of v

Definition: l protects v if l is held in write mode for every write of v

Example of R/W Lock Solution

t1 t2 l_held(t1) l_held(t2) C(v) { } { } { } { } { l1 } { l1 } { l1 } ++v { } unlock(l1) { } read(v) unlock(l1) { } { } { }

wl_held(t1) wl_held(t2)

rdlock(l1) rdlock(l1)

Implementation Details

Approach: Automatically instruments program binary with calls to Eraser runtime ๎€Š (^) memory loads and stores ๎€Š (^) lock acquires and releases ๎€Š (^) storage allocators

Warning messages: ๎€Š (^) Source file and line number where race discovered ๎€Š (^) Backtrace listing all active stack frames ๎€Š (^) Thread ID ๎€Š (^) Memory address ๎€Š (^) Type of memory access ๎€Š (^) Register values such as program counter and stack pointer