Skip to main content

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

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 8586))

Abstract

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.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. RavenDB 2nd generation document database (May 2014), http://ravendb.net

  2. Antlrcs (May 2014), http://github.com/antlr/antlrcs

  3. Dynamo App. (May 2014), https://github.com/ikeough/Dynamo

  4. Jace App. (May 2014), https://github.com/pieterderycke/Jace

  5. Kudu App. (May 2014), https://github.com/projectkudu/kudu

  6. Lucene.NET App. (May 2014), https://github.com/apache/lucene.net

  7. Tiraggo App. (May 2014), https://github.com/BrewDawg/Tiraggo

  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. 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. 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. Dig, D., Tarce, M., Radoi, C., Minea, M., Johnson, R.: Relooper. In: Proceedings of the OOPSLA 2009, pp. 793–794 (2009)

    Google Scholar 

  12. Github (May 2014), https://github.com

  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. Lea, D.: A Java fork/join framework. In: Proceedings of the ACM 2000 Conference on Java Grande, pp. 36–43 (2000)

    Google Scholar 

  15. Leijen, D., Hall, J.: Parallel Performance: Optimize Managed Code For Multi-Core Machines. In: MSDN (October 2007)

    Google Scholar 

  16. Leijen, D., Schulte, W., Burckhardt, S.: The design of a task parallel library. ACM SIGPLAN Notices 44(10), 227 (2009)

    Article  Google Scholar 

  17. Nuget (May 2014), http://www.nuget.org/

  18. Okur, S., Dig, D.: How do developers use parallel libraries? In: Proceedings of the FSE 2012, pp. 54–65 (2012)

    Google Scholar 

  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. Stack Overflow (May 2014), http://stackoverflow.com

  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. The Roslyn Project (May 2014), http://msdn.microsoft.com/en-us/hh500769

  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)

    Chapter  Google Scholar 

  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. 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. Toub, S.: Patterns of Parallel Programming. Microsoft Corporation (2010)

    Google Scholar 

  27. Wloka, J., Sridharan, M., Tip, F.: Refactoring for reentrancy. In: Proceedings of the FSE 2009, pp. 173–182 (2009)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Okur, S., Erdogan, C., Dig, D. (2014). Converting Parallel Code from Low-Level Abstractions to Higher-Level Abstractions. In: Jones, R. (eds) ECOOP 2014 – Object-Oriented Programming. ECOOP 2014. Lecture Notes in Computer Science, vol 8586. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-44202-9_21

Download citation

  • DOI: https://doi.org/10.1007/978-3-662-44202-9_21

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-662-44201-2

  • Online ISBN: 978-3-662-44202-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics