Determinism at Standard-Library Level in TM-Based Applications

Abstract

Deterministic execution of a multi-threaded application guarantees that threads access shared memory in the same order and the application gives the same output whenever it runs with the same input parameters. Determinism provides repeatability, which helps programmers in testing and debugging. Additionally, transactional memory (TM) simplifies development of multi-threaded applications so that programmers can use transactions (instead of locks) to synchronize accesses to shared memory. However, transactions that call standard library functions have to be serialized, i.e. to be executed as the only running transactions in the system. The serialization enforces an order of threads execution usually different from the one enforced by a system for deterministic multithreading, which causes deadlocks in the application execution. In this paper, we present DeTrans-lib, the first standard C library that provides deterministic execution of TM-based applications at application and standard-library level. DeTrans-lib avoids deadlocks by performing transaction serialization in deterministic order. We evaluate DeTrans-lib with the benchmarks that invoke a standard C library and perform I/O operations.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3

Notes

  1. 1.

    A part of serialization is implemented in the TM library, but we present it as inlined in TM-dietlibc to keep the listing simple.

  2. 2.

    We discuss ad hoc synchronization in deterministic execution in detail in Sect. 6.

References

  1. 1.

    Aviram, A., Weng, S.C., Hu, S., Ford, B.: Efficient system-enforced deterministic parallelism. In: Proceedings of the 9th USENIX Conference on Operating Systems Design and Implementation, OSDI’10, pp. 1–16. USENIX Association, Berkeley, CA(2010). http://dl.acm.org/citation.cfm?id=1924943.1924957

  2. 2.

    Bergan, T., Anderson, O., Devietti, J., Ceze, L., Grossman, D.: CoreDet: a compiler and runtime system for deterministic multithreaded execution. In: Proceedings of the Fifteenth Edition of ASPLOS on Architectural Support for Programming Languages and Operating Systems, ASPLOS ’10, pp. 53–64. ACM, New York (2010)

  3. 3.

    Berger, E.D., Yang, T., Liu, T., Novark, G.: Grace: safe multithreaded programming for c/c++. SIGPLAN Not. 44(10), 81–96 (2009). doi:10.1145/1639949.1640096

    Article  Google Scholar 

  4. 4.

    Cain, H.W., Michael, M.M., Frey, B., May, C., Williams, D., Le, H.: Robust architectural support for transactional memory in the power architecture. In: Proceedings of the 40th Annual International Symposium on Computer Architecture, ISCA ’13, pp. 225–236. ACM, New York (2013). doi:10.1145/2485922.2485942

  5. 5.

    Devietti, J., Lucia, B., Ceze, L., Oskin, M.: DMP: deterministic shared memory multiprocessing. In: Proceedings of the 14th International Conference on Architectural Support for Programming Languages and Operating Systems, ASPLOS ’09, pp. 85–96. ACM, New York (2009)

  6. 6.

    Devietti, J., Nelson, J., Bergan, T., Ceze, L., Grossman, D.: RCDC: a relaxed consistency deterministic computer. SIGPLAN Not. 47(4), 67–78 (2011)

    Article  Google Scholar 

  7. 7.

    Döbel, B., Härtig, H.: Can we put concurrency back into redundant multithreading? In: Proceedings of the 14th International Conference on Embedded Software, EMSOFT ’14, pp. 19:1–19:10. ACM, New York (2014). doi:10.1145/2656045.2656050

  8. 8.

    Felber, P., Fetzer, C., Riegel, T.: Dynamic performance tuning of word-based software transactional memory. In: Proceedings of the 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, pp. 237–246. PPoPP ’08. ACM, New York (2008)

  9. 9.

    Hammond, L., Wong, V., Chen, M., Carlstrom, B.D., Davis, J.D., Hertzberg, B., Prabhu, M.K., Wijaya, H., Kozyrakis, C., Olukotun, K.: Transactional memory coherence and consistency. SIGARCH Comput. Archit. News 32(2), 102 (2004). doi:10.1145/1028176.1006711

    Article  Google Scholar 

  10. 10.

    Harris, T., Larus, J., Rajwar, R.: Transactional memory. Synth. Lect. Comput. Archit. 5(1), 1–263 (2010)

    MathSciNet  Article  Google Scholar 

  11. 11.

    Herlihy, M., Moss, J.E.B.: Transactional memory: Architectural support for lock-free data structures. In: Proceedings of the 20th Annual International Symposium on Computer Architecture, ISCA ’93, pp. 289–300 (1993)

  12. 12.

    Hill, M.D., Xu, M.: Racey: a stress test for deterministic execution. http://www.cs.wisc.edu/~markhill/racey.html

  13. 13.

    Hong, S., Oguntebi, T., Casper, J., Bronson, N., Kozyrakis, C., Olukotun, K.: Eigenbench: a simple exploration tool for orthogonal tm characteristics. In: Proceedings of the IEEE International Symposium on Workload Characterization, IISWC ’10, pp. 1–11. IEEE Computer Society, Washington, DC (2010). doi:10.1109/IISWC.2010.5648812

  14. 14.

    Karnagel, T., Dementiev, R., Rajwar, R., Lai, K., Legler, T., Schlegel, B., Lehner, W.: Improving in-memory database index performance with intel transactional synchronization extensions. In: 2014 IEEE 20th International Symposium on High Performance Computer Architecture (HPCA), pp. 476–487 (2014). doi:10.1109/HPCA.2014.6835957

  15. 15.

    Liu, T., Curtsinger, C., Berger, E.: Dthreads: efficient deterministic multithreading. In: Proceedings of the Twenty-Third ACM Symposium on Operating Systems Principles, pp. 327–336. ACM (2011)

  16. 16.

    Merrifield, T., Devietti, J., Eriksson, J.: High-performance determinism with total store order consistency. In: Proceedings of the Tenth European Conference on Computer Systems, EuroSys ’15, pp. 31:1–31:13. ACM, New York (2015). doi:10.1145/2741948.2741960

  17. 17.

    Merrifield, T., Eriksson, J.: Conversion: multi-version concurrency control for main memory segments. In: Proceedings of the 8th ACM European Conference on Computer Systems, EuroSys ’13, pp. 127–139. ACM, New York (2013). doi:10.1145/2465351.2465365

  18. 18.

    Minh, C., Chung, J., Kozyrakis, C., Olukotun, K.: STAMP: stanford transactional applications for multi-processing. In: IEEE International Symposium on Workload Characterization, 2008. IISWC 2008, pp. 35–46. IEEE

  19. 19.

    Olszewski, M., Ansel, J., Amarasinghe, S.: Kendo: efficient deterministic multithreading in software. SIGPLAN Not. 44(3), 97–108 (2009)

    Article  Google Scholar 

  20. 20.

    Ravichandran, K., Gavrilovska, A., Pande, S.: DeSTM: harnessing determinism in STMs for application development. In: Proceedings of the 23rd International Conference on Parallel Architectures and Compilation, PACT ’14, pp. 213–224. ACM, New York (2014). doi:10.1145/2628071.2628094

  21. 21.

    Ruan, W., Vyas, T., Liu, Y., Spear, M.: Transactionalizing legacy code: an experience report using gcc and memcached. In: Proceedings of the 19th International Conference on Architectural Support for Programming Languages and Operating Systems, ASPLOS ’14, pp. 399–412. ACM, New York (2014). doi:10.1145/2541940.2541960

  22. 22.

    Serebryany, K., Iskhodzhanov, T.: Threadsanitizer: Data race detection in practice. In: Proceedings of the Workshop on Binary Instrumentation and Applications, WBIA ’09, pp. 62–71. ACM, New York, NY (2009). doi:10.1145/1791194.1791203

  23. 23.

    Shavit, N., Touitou, D.: Software transactional memory. In: Proceedings of the Fourteenth Annual ACM Symposium on Principles of Distributed Computing, PODC ’95, pp. 204–213. ACM, New York (1995). doi:10.1145/224964.224987

  24. 24.

    Smiljkovic, V., Nowack, M., Miletic, N., Harris, T., Unsal, O., Cristal, A., Valero, M.: TM-dietlibc: A tm-aware real-world system library. In: 2013 IEEE 27th International Symposium on Parallel Distributed Processing (IPDPS), pp. 1266–1274 (2013). doi:10.1109/IPDPS.2013.45

  25. 25.

    Smiljkovic, V., Stipic, S., Fetzer, C., Unsal, O., Cristal, A., Valero, M.: Detrans: Deterministic and parallel execution of transactions. In: IEEE 26th International Symposium on Computer Architecture and High Performance Computing (SBAC-PAD), 2014, pp. 152–159 (2014). doi:10.1109/SBAC-PAD.2014.20

  26. 26.

    Vianney, D.: Tiobench benchmark: ltc linux performance team. http://linuxperf.sourceforge.net/tiobench/tiobench.php

  27. 27.

    Xiong, W., Park, S., Zhang, J., Zhou, Y., Ma, Z.: Ad hoc synchronization considered harmful. In: Proceedings of the 9th USENIX Conference on Operating Systems Design and Implementation, OSDI’10, pp. 1–8. USENIX Association, Berkeley, CA (2010). http://dl.acm.org/citation.cfm?id=1924943.1924955

  28. 28.

    Xu, M., Bodik, R., Hill, M.D.: A ”flight data recorder” for enabling full-system multiprocessor deterministic replay. In: Proceedings 30th Annual International Symposium on Computer Architecture, 2003, pp. 122–133. IEEE (2003)

  29. 29.

    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. SIGPLAN Not. 44(4), 25–34 (2009). doi:10.1145/1594835.1504183

    Article  Google Scholar 

Download references

Acknowledgments

We would like to thank Martin Nowack, Srdjan Stipić, Joseph Devietti, and the anonymous reviewers for their comments and valuable feedback. This work was supported by the Ministry of Science and Technology of Spain (TIN2012-34557) and Generalitat de Catalunya (2009-SGR-980).

Author information

Affiliations

Authors

Corresponding author

Correspondence to Vesna Smiljković.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Smiljković, V., Ünsal, O., Cristal, A. et al. Determinism at Standard-Library Level in TM-Based Applications. Int J Parallel Prog 45, 17–29 (2017). https://doi.org/10.1007/s10766-015-0383-4

Download citation

Keywords

  • Transactional memory
  • Deterministic multithreading
  • Concurrency bugs
  • Standard library
  • Serialization