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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
RavenDB 2nd generation document database (May 2014), http://ravendb.net
Antlrcs (May 2014), http://github.com/antlr/antlrcs
Dynamo App. (May 2014), https://github.com/ikeough/Dynamo
Jace App. (May 2014), https://github.com/pieterderycke/Jace
Kudu App. (May 2014), https://github.com/projectkudu/kudu
Lucene.NET App. (May 2014), https://github.com/apache/lucene.net
Tiraggo App. (May 2014), https://github.com/BrewDawg/Tiraggo
Balaban, I., Tip, F., Fuhrer, R.: Refactoring support for class library migration. In: Proceedings of the OOPSLA 2005, pp. 265–279 (2005)
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)
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)
Dig, D., Tarce, M., Radoi, C., Minea, M., Johnson, R.: Relooper. In: Proceedings of the OOPSLA 2009, pp. 793–794 (2009)
Github (May 2014), https://github.com
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)
Lea, D.: A Java fork/join framework. In: Proceedings of the ACM 2000 Conference on Java Grande, pp. 36–43 (2000)
Leijen, D., Hall, J.: Parallel Performance: Optimize Managed Code For Multi-Core Machines. In: MSDN (October 2007)
Leijen, D., Schulte, W., Burckhardt, S.: The design of a task parallel library. ACM SIGPLAN Notices 44(10), 227 (2009)
Nuget (May 2014), http://www.nuget.org/
Okur, S., Dig, D.: How do developers use parallel libraries? In: Proceedings of the FSE 2012, pp. 54–65 (2012)
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)
Stack Overflow (May 2014), http://stackoverflow.com
Pankratius, V., Schaefer, C., Jannesari, A., Tichy, W.F.: Software engineering for multicore systems. In: Proceedings of the IWMSE 2008, pp. 53–60 (2008)
The Roslyn Project (May 2014), http://msdn.microsoft.com/en-us/hh500769
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)
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)
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)
Toub, S.: Patterns of Parallel Programming. Microsoft Corporation (2010)
Wloka, J., Sridharan, M., Tip, F.: Refactoring for reentrancy. In: Proceedings of the FSE 2009, pp. 173–182 (2009)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)