Major Project, CSD411cs1100211/files/btp_presentation.pdf · Major Project, CSD411 Deterministic...

12
Major Project, CSD411 Deterministic Execution In Multithreaded Applications Ashwin Kumar 2010CS10211 12/31/2013 1 Deterministic Execution In Multithreaded Applications Himanshu Gupta 2010CS10220 Supervisor Prof. Sorav Bansal

Transcript of Major Project, CSD411cs1100211/files/btp_presentation.pdf · Major Project, CSD411 Deterministic...

Page 1: Major Project, CSD411cs1100211/files/btp_presentation.pdf · Major Project, CSD411 Deterministic Execution In Multithreaded Applications Ashwin Kumar 2010CS10211 1 Deterministic Execution

Major Project, CSD411

Deterministic ExecutionIn Multithreaded Applications

Ashwin Kumar2010CS10211

12/31/20131 Deterministic Execution In Multithreaded Applications

Himanshu Gupta2010CS10220

SupervisorProf. Sorav Bansal

Page 2: Major Project, CSD411cs1100211/files/btp_presentation.pdf · Major Project, CSD411 Deterministic Execution In Multithreaded Applications Ashwin Kumar 2010CS10211 1 Deterministic Execution

Project Overview

Multithreaded programming is challenging

Race conditions, deadlocks

Different runs produce different outputs

Non-determinism complicates it further

Debugging, testing

Reproducing errors in multithreaded applications

Existing solutions are inefficient, don’t work for general case

Coredet: Upto 8x slowdown

Kendo: Does not guarantee determinism with data races

Start with Dthreads which makes the most significant claims

12/31/20132 Deterministic Execution In Multithreaded Applications

Page 3: Major Project, CSD411cs1100211/files/btp_presentation.pdf · Major Project, CSD411 Deterministic Execution In Multithreaded Applications Ashwin Kumar 2010CS10211 1 Deterministic Execution

DTHREADS

Key ideas

Efficient deterministic multithreaded system

Threads run as processes (and thus working on isolated memory)

Deterministic memory commit protocol

Concept of serial (at synchronization points) and parallel phases

Enhances performance by eliminating false sharing of cache lines

12/31/20133 Deterministic Execution In Multithreaded Applications

Page 4: Major Project, CSD411cs1100211/files/btp_presentation.pdf · Major Project, CSD411 Deterministic Execution In Multithreaded Applications Ashwin Kumar 2010CS10211 1 Deterministic Execution

Mid-Term Status

Understanding the code flow

Testing sample programs on Dthreads

Debugging the code

12/31/20138 Deterministic Execution In Multithreaded Applications

Page 5: Major Project, CSD411cs1100211/files/btp_presentation.pdf · Major Project, CSD411 Deterministic Execution In Multithreaded Applications Ashwin Kumar 2010CS10211 1 Deterministic Execution

Current Status

Code is now working

Fixed bugs e.g. commit at granularity of long long

Evaluated on benchmarks and compared performance with pthreads

Analyzed each benchmark for reasons accounting for performance variation among Dthreads and Pthreads

12/31/20139 Deterministic Execution In Multithreaded Applications

Page 6: Major Project, CSD411cs1100211/files/btp_presentation.pdf · Major Project, CSD411 Deterministic Execution In Multithreaded Applications Ashwin Kumar 2010CS10211 1 Deterministic Execution

Benchmark Analysis (Part 1)

Dthreads = Pthreads

Pseudo parallel benchmarks

No synchronization primitive other than create and join

12/31/201310 Deterministic Execution In Multithreaded Applications

0.000

0.500

1.000

1.500

2.000

2.500

3.000

3.500

4.000

4.500

1 2 3

Execu

tio

n T

ime

Dataset Size (Small to Large)

String Match

pthreads

dthreads

0.000

1.000

2.000

3.000

4.000

5.000

6.000

1 2 3

Execu

tio

n T

ime

Dataset Size (Small to Large)

Matrix Multiply

pthreads

dthreads

Page 7: Major Project, CSD411cs1100211/files/btp_presentation.pdf · Major Project, CSD411 Deterministic Execution In Multithreaded Applications Ashwin Kumar 2010CS10211 1 Deterministic Execution

Benchmark Analysis (Part 2)

Dthreads < Pthreads

Benefit of false sharing exposed

Parallel program where each

thread accumulates read only

input values

Running as processes means

each thread can work using

isolated memory

12/31/201311 Deterministic Execution In Multithreaded Applications

0.000

0.200

0.400

0.600

0.800

1.000

1.200

1 2 3

Execu

tio

n T

ime

Dataset Size (Small to Large)

Linear Regression

pthreads

dthreads

Page 8: Major Project, CSD411cs1100211/files/btp_presentation.pdf · Major Project, CSD411 Deterministic Execution In Multithreaded Applications Ashwin Kumar 2010CS10211 1 Deterministic Execution

Benchmark Analysis (Part 3)

Dthreads > Pthreads

Multiple threads accessing

a shared data structure using

locks

Number of transactions is

very large

12/31/201312 Deterministic Execution In Multithreaded Applications

0.000

1.000

2.000

3.000

4.000

5.000

6.000

7.000

8.000

1 2 3

Execu

tio

n T

ime

Dataset Size (Small to Large)

Reverse Index

pthreads

dthreads

Page 9: Major Project, CSD411cs1100211/files/btp_presentation.pdf · Major Project, CSD411 Deterministic Execution In Multithreaded Applications Ashwin Kumar 2010CS10211 1 Deterministic Execution

Possible Optimizations (Part 1)

Fine grained locking

Currently, Dthreads converts all locks into one global lock via the token mechanism

Prevents acquisition of independent locks

Can modify this to have a locked/unlocked state for every lock

Update of lock state requires token

12/31/201314 Deterministic Execution In Multithreaded Applications

Page 10: Major Project, CSD411cs1100211/files/btp_presentation.pdf · Major Project, CSD411 Deterministic Execution In Multithreaded Applications Ashwin Kumar 2010CS10211 1 Deterministic Execution

Possible Optimizations (Part 2)

Handling load imbalances

Allowing user to insert explicit synch points in code

Trade off between increase in number of transactions and benefit due to load balancing

Work Ahead : Work on these optimisations and evaluate performance benefits

12/31/201315 Deterministic Execution In Multithreaded Applications

Page 11: Major Project, CSD411cs1100211/files/btp_presentation.pdf · Major Project, CSD411 Deterministic Execution In Multithreaded Applications Ashwin Kumar 2010CS10211 1 Deterministic Execution

References

DTHREADS: Efficient and Deterministic Multithreading by TongpingLiu, Charlie Curtsinger, Emery D. Berger

Kendo: Efficient Deterministic Multithreading in Software by MarekOlszewski, Jason Ansel, Saman Amarasinghe

Efficient System-Enforced Deterministic Parallelism by Amittai Aviram, Shu-Chun Weng, Sen Hu, Bryan Ford

DoublePlay: Parallelizing Sequential Logging and Replay by KaushikVeeraraghavan, Dongyoon Lee, Benjamin Wester, Jessica Ouyang, Peter M. Chen, Jason Flinn, Satish Narayanasamy

Execution Replay for Multiprocessor Virtual Machines by George W. Dunlap, Dominic G. Lucchetti, Peter M. Chen, Michael A. Fetterman

ReTrace: Collecting Execution Trace with Virtual Machine Deterministic Replay by Min Xu, Vyacheslav Malyugin, Jeffrey Sheldon, GaneshVenkitachalam, Boris Weissman

12/31/201316 Deterministic Execution In Multithreaded Applications

Page 12: Major Project, CSD411cs1100211/files/btp_presentation.pdf · Major Project, CSD411 Deterministic Execution In Multithreaded Applications Ashwin Kumar 2010CS10211 1 Deterministic Execution

THANK YOU

Any Question?

12/31/201317 Deterministic Execution In Multithreaded Applications