Skip to main content

Towards Automatic Lock Removal for Scalable Synchronization

  • Conference paper
  • First Online:
Distributed Computing (DISC 2015)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9363))

Included in the following conference series:

Abstract

We present a code transformation for concurrent data structures, which increases their scalability without sacrificing correctness. Our transformation takes lock-based code and replaces some of the locking steps therein with optimistic synchronization in order to reduce contention. The main idea is to have each operation perform an optimistic traversal of the data structure as long as no shared memory locations are updated, and then proceed with pessimistic code. The transformed code inherits essential properties of the original one, including linearizability, serializability, and deadlock freedom.

Our work complements existing pessimistic transformations that make sequential code thread-safe by adding locks. In essence, we provide a way to optimize such transformations by reducing synchronization bottlenecks (for example, locking the root of a tree). The resulting code scales well and significantly outperforms pessimistic approaches. We further compare our synthesized code to state-of-the-art data structures implemented by experts. We find that its performance is comparable to that achieved by the custom-tailored implementations. Our work thus shows the promise that automated approaches bear for overcoming the difficulty involved in manually hand-crafting concurrent data structures.

Maya Arbel is supported in part by the Technion Hasso Platner Institute (HPI) Research School.

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

Access this chapter

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

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Concurrentskiplistmap from java.util.concurrent. http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentSkipListMap.html

  2. A fast and lightweight key/value database library by google. http://code.google.com/p/leveldb

  3. jmonkeyengine: a 3d game engine for java developers. http://jmonkeyengine.org/

  4. Afek, Y., Attiya, H., Dolev, D., Gafni, E., Merritt, M., Shavit, N.: Atomic snapshots of shared memory. J. ACM 40(4), 873–890 (1993)

    Article  MATH  Google Scholar 

  5. Afek, Y., Kaplan, H., Korenfeld, B., Morrison, A., Tarjan, R.E.: CBTree: a practical concurrent self-adjusting search tree. In: Aguilera, M.K. (ed.) DISC 2012. LNCS, vol. 7611, pp. 1–15. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  6. Afek, Y., Levy, A., Morrison, A.: Software-improved hardware lock elision. In: PODC (2014)

    Google Scholar 

  7. Aragon, C.R., Seidel, R.: Randomized search trees. In: FOCS, pp. 540–545 (1989)

    Google Scholar 

  8. Arbel, M., Attiya, H.: Concurrent updates with RCU: search tree as an example. In: PODC, pp. 196–205 (2014)

    Google Scholar 

  9. Arbel, M., Golan-Gueta, G., Hillel, E., Keidar, I.: Towards automatic lock removal for scalable synchronization (full version). https://labs.yahoo.com/publications/8476/towards-automatic-lock-removal- scalable-synchronization-full-version

  10. Braginsky, A., Petrank, E.: A lock-free B+tree. In: SPAA, pp. 58–67 (2012)

    Google Scholar 

  11. Bronson, N.G., Casper, J., Chafi, H., Olukotun, K.: A practical concurrent binary search tree. In: PPOPP, pp. 257–268 (2010)

    Google Scholar 

  12. Brown, T., Ellen, F., Ruppert, E.: A general technique for non-blocking trees. In: PPoPP, pp. 329–342 (2014)

    Google Scholar 

  13. Cascaval, C., Blundell, C., Michael, M., Cain, H.W., Wu, P., Chiras, S., Chatterjee, S.: Software transactional memory: Why is it only a research toy? Queue 6(5), 46–58 (2008)

    Article  Google Scholar 

  14. Cherem, S., Chilimbi, T., Gulwani, S.: Inferring locks for atomic sections. In: PLDI (2008)

    Google Scholar 

  15. Crain, T., Gramoli, V., Raynal, M.: A contention-friendly binary search tree. In: Wolf, F., Mohr, B., an Mey, D. (eds.) Euro-Par 2013. LNCS, vol. 8097, pp. 229–240. Springer, Heidelberg (2013)

    Chapter  Google Scholar 

  16. Cunningham, D., Gudka, K., Eisenbach, S.: Keep off the grass: locking the right path for atomicity. In: Hendren, L. (ed.) CC 2008. LNCS, vol. 4959, pp. 276–290. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  17. Dice, D., Harris, T.L., Kogan, A., Lev, Y., Moir, M.: Hardware extensions to make lazy subscription safe (2014). CoRR, abs/1407.6968

    Google Scholar 

  18. Dice, D., Shalev, O., Shavit, N.: Transactional locking II. In: Dolev, S. (ed.) DISC 2006. LNCS, vol. 4167, pp. 194–208. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  19. Doherty, S., Detlefs, D.L., Groves, L., Flood, C.H., Luchangco, V., Martin, P.A., Moir, M., Shavit, N., Steele Jr, G.L.: Dcas is not a silver bullet for nonblocking algorithm design. In: SPAA (2004)

    Google Scholar 

  20. Drachsler, D., Vechev, M.T., Yahav, E.: Practical concurrent binary search trees via logical ordering. In: PPoPP, pp. 343–356 (2014)

    Google Scholar 

  21. Duffy, J.: A (brief) retrospective on transactional memory (2010). http://joeduffyblog.com/2010/01/03/a-brief-retrospective-on-transactional-memory

  22. Ellen, F., Fatourou, P., Ruppert, E., van Breugel, F.: Non-blocking binary search trees. In: PODC, pp. 131–140 (2010)

    Google Scholar 

  23. Emmi, M., Fischer, J.S., Jhala, R., Majumdar, R.: Lock allocation. In: POPL, pp. 291–296 (2007)

    Google Scholar 

  24. Felber, G.K., Shavit, P.N.: Deuce: noninvasive concurrency with a Java STM. In: MULTIPROG (2010)

    Google Scholar 

  25. Fraser, K.: Practical lock-freedom. Ph.D thesis, University of Cambridge (2004)

    Google Scholar 

  26. Golan-Gueta, G., Bronson, N.G., Aiken, A., Ramalingam, G., Sagiv, M., Yahav, E.: Automatic fine-grain locking using shape properties. In: OOPSLA, pp. 225–242 (2011)

    Google Scholar 

  27. Gramoli, V.: More than you ever wanted to know about synchronization: synchrobench, measuring the impact of the synchronization on concurrent algorithms. In: PPoPP (2015)

    Google Scholar 

  28. Gudka, K., Harris, T., Eisenbach, S.: Lock inference in the presence of large libraries. In: Noble, J. (ed.) ECOOP 2012. LNCS, vol. 7313, pp. 308–332. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  29. Guerraoui, R., Kapalka, M.: On the correctness of transactional memory. In: PPOPP, pp. 175–184 (2008)

    Google Scholar 

  30. Harris, T., Larus, J., Rajwar, R.: Transactional memory, 2nd edn. Synthesis Lectures on Computer Architecture, vol. 5(1) (2010)

    Google Scholar 

  31. Heller, S., Herlihy, M., Luchangco, V., Moir, M., Scherer III, W.N., Shavit, N.: A lazy concurrent list-based set algorithm. In: Anderson, J.H., Prencipe, G., Wattenhofer, R. (eds.) OPODIS 2005. LNCS, vol. 3974, pp. 3–16. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  32. Herlihy, M., Lev, Y., Luchangco, V., Shavit, N.: A simple optimistic skiplist algorithm. In: Prencipe, G., Zaks, S. (eds.) SIROCCO 2007. LNCS, vol. 4474, pp. 124–138. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  33. Hicks, M., Foster, J.S., Prattikakis, P.: Lock inference for atomic sections. In: Proceedings of the First ACM SIGPLAN Workshop on Languages Compilers, and Hardware Support for Transactional Computing, June 2006

    Google Scholar 

  34. Israeli, A., Rappoport, L.: Disjoint-access-parallel implementations of strong shared memory primitives. In: PODC, pp. 151–160 (1994)

    Google Scholar 

  35. Jin, G., Zhang, W., Deng, D., Liblit, B., Lu, S.: Automated concurrency-bug fixing. In: OSDI (2012)

    Google Scholar 

  36. McCloskey, B., Zhou, F., Gay, D., Brewer, E.: Autolocker: synchronization inference for atomic sections. In: POPL, pp. 346–358 (2006)

    Google Scholar 

  37. McKenney, P.E.: Is parallel programming hard, and if so, what can you do about it?. Linux Technology Center. IBM Beaverton, August 2012

    Google Scholar 

  38. Michael, M.M., Scott, M.L.: Simple, fast, and practical non-blocking and blocking concurrent queue algorithms. In: PODC (1996)

    Google Scholar 

  39. Nakaike, T., Michael, M.M.: Lock elision for read-only critical sections in java. In: PLDI, pp. 269–278 (2010)

    Google Scholar 

  40. Natarajan, A., Mittal, N.: Fast concurrent lock-free binary search trees. In: PPoPP, pp. 317–328 (2014)

    Google Scholar 

  41. Rajwar, R., Goodman, J.R.: Transactional lock-free execution of lock-based programs. SIGOPS Oper. Syst. Rev. 36(5), 5–17 (2002)

    Article  Google Scholar 

  42. Roy, A., Hand, S., Harris, T.: A runtime system for software lock elision. In: EuroSys (2009)

    Google Scholar 

  43. Shacham, O.: Verifying Atomicity of Composed Concurrent Operations. Ph.D thesis, Tel Aviv University (2012)

    Google Scholar 

  44. Shacham, O., Bronson, N., Aiken, A., Sagiv, M., Vechev, M., Yahav, E.: Testing atomicity of composed concurrent operations. In: OOPSLA (2011)

    Google Scholar 

  45. Shalev, O., Shavit, N.: Predictive log-synchronization. In: Berbers, Y., Zwaenepoel, W. (eds.) EuroSys, pp. 305–315. ACM (2006)

    Google Scholar 

  46. Zyulkyarov, F., Gajinov, V., Unsal, O.S., Cristal, A., Ayguadé, E., Harris, T., Valero, M.: Atomic quake: using transactional memory in an interactive multiplayer game server. In: ACM Sigplan Notices, vol. 44, pp. 25–34. ACM (2009)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Eshcar Hillel .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Arbel, M., Golan-Gueta, G., Hillel, E., Keidar, I. (2015). Towards Automatic Lock Removal for Scalable Synchronization. In: Moses, Y. (eds) Distributed Computing. DISC 2015. Lecture Notes in Computer Science(), vol 9363. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-48653-5_12

Download citation

  • DOI: https://doi.org/10.1007/978-3-662-48653-5_12

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-662-48652-8

  • Online ISBN: 978-3-662-48653-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics