Abstract
It is challenging to reason about the behaviors of concurrent programs because of the non-deterministic interleaving execution of threads. To simplify the reasoning, we propose a non-preemptive semantics for data-race-free (DRF) concurrent programs, where a thread yields the control of the CPU only at certain carefully-chosen program points. We formally prove that DRF concurrent programs behave the same in the standard interleaving semantics and in our non-preemptive semantics. We also propose a novel formulation of data-race-freedom in our non-preemptive semantics, called NPDRF, which is proved equivalent to the standard DRF notion in the interleaving semantics.
Keywords
This work is supported in part by grants from National Natural Science Foundation of China (NSFC) under Grant Nos. 61502442 and 61632005.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
In this case, we don’t view two concurrent print commands as a data race. Instead, we assume there is an implicit enclosing atomic block for each \(\mathbf print (e)\).
References
Abadi, M., Plotkin, G.: A model of cooperative threads. In: Proceedings of 36th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2009, Savannah, GA, January 2009, pp. 29–40. ACM Press, New York (2009). https://doi.org/10.1145/1480881.1480887
Adve, S.V., Hill, M.D.: Weak ordering: a new definition. In: Proceedings of 17th Annual International Symposium on Computer Architecture, ISCA 1990, Seattle, WA, June 1990, pp. 2–14. ACM Press, New York (1990). https://doi.org/10.1145/325164.325100
Adve, S.V., Hill, M.D.: A unified formalization of four shared-memory models. IEEE Trans. Parallel Distrib. Syst. 4(6), 613–624 (1993). https://doi.org/10.1109/71.242161
von Behren, R., Condit, J., Zhou, F., Necula, G.C., Brewer, E.: Capriccio: scalable threads for internet services. In: Proceedings of 19th ACM Symposium on Operating Systems Principles, SOSP 2003, Bolton Landing, NY, October 2003, pp. 268–281. ACM Press, New York (2003). https://doi.org/10.1145/945445.945471
Beringer, L., Stewart, G., Dockins, R., Appel, A.W.: Verified compilation for shared-memory C. In: Shao, Z. (ed.) ESOP 2014. LNCS, vol. 8410, pp. 107–127. Springer, Heidelberg (2014). https://doi.org/10.1007/978-3-642-54833-8_7
Boudol, G.: Fair cooperative multithreading. In: Caires, L., Vasconcelos, V.T. (eds.) CONCUR 2007. LNCS, vol. 4703, pp. 272–286. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-74407-8_19
Collingbourne, P., Donaldson, A.F., Ketema, J., Qadeer, S.: Interleaving and lock-step semantics for analysis and verification of GPU kernels. In: Felleisen, M., Gardner, P. (eds.) ESOP 2013. LNCS, vol. 7792, pp. 270–289. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-37036-6_16
Ferreira, R., Feng, X., Shao, Z.: Parameterized memory models and concurrent separation logic. In: Gordon, A.D. (ed.) ESOP 2010. LNCS, vol. 6012, pp. 267–286. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-11957-6_15
Hower, D.R., et al.: Heterogeneous-race-free memory models. In: Architectural Support for Programming Languages and Operating Systems, ASPLOS 2014, Salt Lake City, UT, March 2014, pp. 427–440. ACM Press (2014). https://doi.org/10.1145/2541940.2541981
Kojima, K., Igarashi, A.: A Hoare logic for GPU kernels. ACM Trans. Comput. Log. 18(1), Article No. 3 (2017). https://doi.org/10.1145/3001834
Li, P., Zdancewic, S.: Combining events and threads for scalable network services implementation and evaluation of monadic, application-level concurrency primitives. In: Proceedings of 28th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2007, San Diego, CA, June 2007, pp. 189–199. ACM Press, New York (2007). https://doi.org/10.1145/1250734.1250756
Loring, M.C., Marron, M., Leijen, D.: Semantics of asynchronous JavaScript. In: Proceedings of 13th ACM SIGPLAN Int. Symposium on Dynamic Languages, DLS 2017, Vancouver, BC, October 2017, pp. 51–62. ACM Press, New York (2017). https://doi.org/10.1145/3133841.3133846
Marino, D., Singh, A., Millstein, T., Musuvathi, M., Narayanasamy, S.: DRFx: a simple and efficient memory model for concurrent programming languages. In: Proceedings of 31st ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2010, Toronto, ON, June 2010, pp. 351–362. ACM Press, New York (2010). https://doi.org/10.1145/1806596.1806636
Vouillon, J.: Lwt: a cooperative thread library. In: Proceedings of the of 2008 ACM SIGPLAN Workshop on ML, ML 2008, Victoria, BC, September 2008, pp. 3–12. ACM Press, New York (2008). https://doi.org/10.1145/1411304.1411307
Yi, J., Disney, T., Freund, S.N., Flanagan, C.: Cooperative types for controlling thread interference in Java. In: Proceedings of 2012 International Symposium on Software Testing and Analysis, ISSTA 2012, Minneapolis, MN, July 2012, pp. 232–242. ACM Press (2012). https://doi.org/10.1145/2338965.2336781
Yi, J., Sadowski, C., Flanagan, C.: Cooperative reasoning for preemptive execution. In: Proceedings of 16th ACM Symposium on Principles and Practice of Parallel Programming, PPoPP 2011, San Antonio, TX, February 2011, pp. 147–156. ACM Press, New York (2011). https://doi.org/10.1145/1941553.1941575
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2018 Springer Nature Switzerland AG
About this paper
Cite this paper
Xiao, S., Jiang, H., Liang, H., Feng, X. (2018). Non-preemptive Semantics for Data-Race-Free Programs. In: Fischer, B., Uustalu, T. (eds) Theoretical Aspects of Computing – ICTAC 2018. ICTAC 2018. Lecture Notes in Computer Science(), vol 11187. Springer, Cham. https://doi.org/10.1007/978-3-030-02508-3_27
Download citation
DOI: https://doi.org/10.1007/978-3-030-02508-3_27
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-02507-6
Online ISBN: 978-3-030-02508-3
eBook Packages: Computer ScienceComputer Science (R0)