Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:
description
Transcript of Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:
![Page 1: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/1.jpg)
Static Data Race detection for Concurrent Programs with
Asynchronous Calls
Presenter:
M. Amin Alipour
Software Design Laboratory
http://asd.cs.mtu.edu
![Page 2: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/2.jpg)
Outline
• Introduction• Problem Statement• Main Contribution• Solution• Experimental Results
![Page 3: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/3.jpg)
Introduction
• Data Race:– When there is multiple threads
access a shared data and at least one of them write.
![Page 4: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/4.jpg)
Static Data Race Detection
• Given source code of a program determine the possible places that race may occur.
![Page 5: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/5.jpg)
Detection Criteria
– Soundness• Preserving every real data race
– Accuracy• Keeping the bogus warning low
– Scalability• Being efficient in large programs
![Page 6: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/6.jpg)
Subtleties with Static Detection
• Asynchronous Function Call
• Recursion• Accuracy
int h1 (int x) {return x * x;} int h2 (int y) { return y + y;}struct funcType {int (*func) (int);}void f (int x, funcType *g, int *z) {l2: if ( x > 0) { *z = *(g->func) (x); }l3: else { *z = *(g->func) (-x); }}int main () {struct funcType ft;int a, b, p1, p2, z;struct thread t1, t2;....if (p1) {ft.func = &h1;l0: fork (t1, f, a, ft, &z);join (t1);}...if (p2) {ft.func = &h2;l1: fork (t2, f, b, ft, &z);join (t2);
![Page 7: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/7.jpg)
Main Contribution
• An improvement to – Emami, M., Ghiya, R., and Hendren, L. J.
Context-sensitive interprocedural points-to analysis in the presence of function pointers. In Proceedings of the ACM SIGPLAN 1994 Conference on Programming Language Design and Implementation.
![Page 8: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/8.jpg)
Classical Approach
1- Identify shared variables2- Enumerate control location3- Determine lockset (set of locks held on
all accesses to data at the location)4- Determine possible race locations,
by lockset analysis (Empty lockset
indicates possible data races)5- Prune results in Step 4
![Page 9: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/9.jpg)
Concurrent Control Flow Graph
![Page 10: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/10.jpg)
Example
• Emami and et al’s CCFG
• Unrolled CCFG
![Page 11: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/11.jpg)
Strategy to explore CCFG
• Unroll CCFG until no new data flow tuple D=(A,L) visited.– A is set of aliases– L is Lockset
• Would CCFG be finite?– Yes, the worst case is O(|F||P|2|P| 2|
L| )• |F| number of functions• |P| number of functions cardinality of
Steensgaard’s pointers set• |L| set of locks
![Page 12: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/12.jpg)
Assumptions
• The algorithm uses Steensgard’s algorithm for points-to analysis, which results possible pointers that may point to same objects (variable or function)
• The algorithm assumes that number of statements affecting locks,functions and threads are small.
![Page 13: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/13.jpg)
![Page 14: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/14.jpg)
Pruning the result
• It uses a thread order analysis to remove any warning wherein the program location pairs that do not occur.
![Page 15: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/15.jpg)
Pruning algorithm
![Page 16: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/16.jpg)
Concurrent call graph
int h1 (int x) {return x * x;} int h2 (int y) { return y + y;}struct funcType {int (*func) (int);}void f (int x, funcType *g, int *z) {l2: if ( x > 0) { *z = *(g->func) (x); }l3: else { *z = *(g->func) (-x); }}int main () {struct funcType ft;int a, b, p1, p2, z;struct thread t1, t2;....if (p1) {ft.func = &h1;l0: fork (t1, f, a, ft, &z);join (t1);}...if (p2) {ft.func = &h2;l1: fork (t2, f, b, ft, &z);join (t2);
![Page 17: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/17.jpg)
Experimental Results
![Page 18: Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter:](https://reader035.fdocuments.in/reader035/viewer/2022062500/56814f39550346895dbcd973/html5/thumbnails/18.jpg)
References . V. Kahlon, N, Sinha, Y. Zhang and E. Kruus. “Static Data Race
Detection for Concurrent Programs Asynchronous Calls” The 7th joint meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering (FSE), Amsterdam, The Netherlands. August 2009.