Converting Parallel Code from Low-Level Abstractions to Higher-Level Abstractions

  • Semih Okur
  • Cansu Erdogan
  • Danny Dig
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8586)


Parallel libraries continuously evolve from low-level to higher-level abstractions. However, developers are not up-to-date with these higher-level abstractions, thus their parallel code might be hard to read, slow, and unscalable. Using a corpus of 880 open-source C# applications, we found that developers still use the old Thread and ThreadPool abstractions in 62% of the cases when they use parallel abstractions. Converting code to higher-level abstractions is (i) tedious and (ii) error-prone. e.g., it can harm performance and silence the uncaught exceptions.

We present two automated migration tools, Taskifier and Simplifier that work for C# code. The first tool transforms old style Thread and ThreadPool abstractions to Task abstractions. The second tool transforms code with Task abstractions into higher-level design patterns. Using our code corpus, we have applied these tools 3026 and 405 times, respectively. Our empirical evaluation shows that the tools (i) are highly applicable, (ii) reduce the code bloat, (iii) are much safer than manual transformations. We submitted 66 patches generated by our tools, and the open-source developers accepted 53.


Parallel Class Code Corpus Work Item Parallel Code Code Snippet 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    RavenDB 2nd generation document database (May 2014),
  2. 2.
    Antlrcs (May 2014),
  3. 3.
    Dynamo App. (May 2014),
  4. 4.
  5. 5.
  6. 6.
    Lucene.NET App. (May 2014),
  7. 7.
    Tiraggo App. (May 2014),
  8. 8.
    Balaban, I., Tip, F., Fuhrer, R.: Refactoring support for class library migration. In: Proceedings of the OOPSLA 2005, pp. 265–279 (2005)Google Scholar
  9. 9.
    Dig, D., Marrero, J., Ernst, M.D.: Refactoring sequential Java code for concurrency via concurrent libraries. In: Proceedings of the ICSE 2009, pp. 397–407 (2009)Google Scholar
  10. 10.
    Dig, D., Marrero, J., Ernst, M.D.: How do programs become more concurrent: A story of program transformations. In: Proceedings of the IWMSE 2011, pp. 43–50 (2011)Google Scholar
  11. 11.
    Dig, D., Tarce, M., Radoi, C., Minea, M., Johnson, R.: Relooper. In: Proceedings of the OOPSLA 2009, pp. 793–794 (2009)Google Scholar
  12. 12.
    Github (May 2014),
  13. 13.
    Gyori, A., Franklin, L., Dig, D., Lahoda, J.: Crossing the gap from imperative to functional programming through refactoring. In: Proceedings of the FSE 2013, pp. 543–553 (2013)Google Scholar
  14. 14.
    Lea, D.: A Java fork/join framework. In: Proceedings of the ACM 2000 Conference on Java Grande, pp. 36–43 (2000)Google Scholar
  15. 15.
    Leijen, D., Hall, J.: Parallel Performance: Optimize Managed Code For Multi-Core Machines. In: MSDN (October 2007)Google Scholar
  16. 16.
    Leijen, D., Schulte, W., Burckhardt, S.: The design of a task parallel library. ACM SIGPLAN Notices 44(10), 227 (2009)CrossRefGoogle Scholar
  17. 17.
    Nuget (May 2014),
  18. 18.
    Okur, S., Dig, D.: How do developers use parallel libraries? In: Proceedings of the FSE 2012, pp. 54–65 (2012)Google Scholar
  19. 19.
    Okur, S., Hartveld, D.L., Dig, D., van Deursen, A.: A study and toolkit for asynchronous programming in C#. In: Proceedings of the ICSE 2014, pp. 1117–1127 (2014)Google Scholar
  20. 20.
    Stack Overflow (May 2014),
  21. 21.
    Pankratius, V., Schaefer, C., Jannesari, A., Tichy, W.F.: Software engineering for multicore systems. In: Proceedings of the IWMSE 2008, pp. 53–60 (2008)Google Scholar
  22. 22.
    The Roslyn Project (May 2014),
  23. 23.
    Schäfer, M., Dolby, J., Sridharan, M., Torlak, E., Tip, F.: Correct refactoring of concurrent java code. In: D’Hondt, T. (ed.) ECOOP 2010. LNCS, vol. 6183, pp. 225–249. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  24. 24.
    Schäfer, M., Sridharan, M., Dolby, J., Tip, F.: Refactoring Java programs for flexible locking. In: Proceedings of the ICSE 2011, pp. 71–80 (2011)Google Scholar
  25. 25.
    Torres, W., Pinto, G., Fernandes, B., Oliveira, J.P., Ximenes, F.A., Castor, F.: Are Java programmers transitioning to multicore?: a large scale study of java FLOSS. In: Proceedings of the SPLASH 2011 Workshops, pp. 123–128 (2011)Google Scholar
  26. 26.
    Toub, S.: Patterns of Parallel Programming. Microsoft Corporation (2010)Google Scholar
  27. 27.
    Wloka, J., Sridharan, M., Tip, F.: Refactoring for reentrancy. In: Proceedings of the FSE 2009, pp. 173–182 (2009)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2014

Authors and Affiliations

  • Semih Okur
    • 1
  • Cansu Erdogan
    • 1
  • Danny Dig
    • 2
  1. 1.University of Illinois at Urbana-ChampaignUSA
  2. 2.Oregon State UniversityUSA

Personalised recommendations