{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2025,6,19]],"date-time":"2025-06-19T04:25:05Z","timestamp":1750307105672,"version":"3.41.0"},"reference-count":40,"publisher":"Association for Computing Machinery (ACM)","issue":"4","license":[{"start":{"date-parts":[[2013,1,1]],"date-time":"2013-01-01T00:00:00Z","timestamp":1356998400000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/www.acm.org\/publications\/policies\/copyright_policy#Background"}],"funder":[{"DOI":"10.13039\/501100001602","name":"Science Foundation Ireland","doi-asserted-by":"publisher","award":["10\/CE\/I1855"],"award-info":[{"award-number":["10\/CE\/I1855"]}],"id":[{"id":"10.13039\/501100001602","id-type":"DOI","asserted-by":"publisher"}]}],"content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["ACM Trans. Archit. Code Optim."],"published-print":{"date-parts":[[2013,1]]},"abstract":"<jats:p>We propose a new language-neutral primitive for the LLVM compiler, which provides efficient context switching and message passing between lightweight threads of control. The primitive, called S<jats:sc>wapstack<\/jats:sc>, can be used by any language implementation based on LLVM to build higher-level language structures such as continuations, coroutines, and lightweight threads. As part of adding the primitives to LLVM, we have also added compiler support for passing parameters across context switches. Our modified LLVM compiler produces highly efficient code through a combination of exposing the context switching code to existing compiler optimizations, and adding novel compiler optimizations to further reduce the cost of context switches. To demonstrate the generality and efficiency of our primitives, we add one-shot continuations to C++, and provide a simple fiber library that allows millions of fibers to run on multiple cores, with a work-stealing scheduler and fast inter-fiber sychronization. We argue that compiler-supported lightweight context switching can be significantly faster than using a library to switch between contexts, and provide experimental evidence to support the position.<\/jats:p>","DOI":"10.1145\/2400682.2400695","type":"journal-article","created":{"date-parts":[[2013,1,22]],"date-time":"2013-01-22T15:28:56Z","timestamp":1358868536000},"page":"1-25","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":9,"title":["Compiler support for lightweight context switching"],"prefix":"10.1145","volume":"9","author":[{"given":"Stephen","family":"Dolan","sequence":"first","affiliation":[{"name":"Trinity College Dublin, Ireland"}]},{"given":"Servesh","family":"Muralidharan","sequence":"additional","affiliation":[{"name":"Trinity College Dublin, Ireland"}]},{"given":"David","family":"Gregg","sequence":"additional","affiliation":[{"name":"Lero, Trinity College Dublin, Ireland"}]}],"member":"320","published-online":{"date-parts":[[2013,1,20]]},"reference":[{"key":"e_1_2_1_1_1","doi-asserted-by":"publisher","DOI":"10.1023\/A:1010051815785"},{"key":"e_1_2_1_2_1","doi-asserted-by":"publisher","DOI":"10.1145\/341800.341801"},{"key":"e_1_2_1_3_1","doi-asserted-by":"publisher","DOI":"10.1145\/513829.513855"},{"key":"e_1_2_1_4_1","doi-asserted-by":"publisher","DOI":"10.1145\/324133.324234"},{"key":"e_1_2_1_5_1","doi-asserted-by":"publisher","DOI":"10.1145\/231379.231395"},{"key":"e_1_2_1_6_1","unstructured":"CLBG. 2011. The computer language benchmarks game. http:\/\/shootout.alioth.debian.org\/. CLBG. 2011. The computer language benchmarks game. http:\/\/shootout.alioth.debian.org\/."},{"key":"e_1_2_1_7_1","doi-asserted-by":"publisher","DOI":"10.1145\/366663.366704"},{"key":"e_1_2_1_8_1","unstructured":"Daniel C. H. 1995. Introduction to the programming language occam. http:\/\/www.eg.bucknell.edu\/~cs366\/occam.pdf. Daniel C. H. 1995. Introduction to the programming language occam. http:\/\/www.eg.bucknell.edu\/~cs366\/occam.pdf."},{"key":"e_1_2_1_9_1","doi-asserted-by":"publisher","DOI":"10.1145\/1654059.1654113"},{"volume-title":"Proceedings of the USENIX Annual Technical Conference. USENIX Association, 20","year":"2000","author":"Engelschall R.","key":"e_1_2_1_10_1"},{"key":"e_1_2_1_11_1","unstructured":"Fober D. Letz S. and Orlarey Y. 2002. Lock-Free techniques for concurrent access to shared objects. Actes des Journes d'Informatique Musicale Marseille 143--150. Fober D. Letz S. and Orlarey Y. 2002. Lock-Free techniques for concurrent access to shared objects. Actes des Journes d'Informatique Musicale Marseille 143--150."},{"key":"e_1_2_1_12_1","doi-asserted-by":"publisher","DOI":"10.1145\/277652.277725"},{"key":"e_1_2_1_13_1","unstructured":"Garcia F. and Fernandez J. 2000. Posix thread libraries. Linux J. 2000 70es 36. Garcia F. and Fernandez J. 2000. Posix thread libraries. Linux J. 2000 70es 36."},{"key":"e_1_2_1_14_1","unstructured":"Google. 2012. TCMalloc: Thread-Caching malloc. http:\/\/goog-perftools.sourceforge.net\/doc\/tcmalloc.html. Google. 2012. TCMalloc: Thread-Caching malloc. http:\/\/goog-perftools.sourceforge.net\/doc\/tcmalloc.html."},{"key":"e_1_2_1_15_1","doi-asserted-by":"publisher","DOI":"10.1145\/248209.237149"},{"key":"e_1_2_1_16_1","doi-asserted-by":"publisher","DOI":"10.1145\/1105664.1105678"},{"volume-title":"A parallel and multithreaded ERLANG implementation. Masters dissertation","author":"Hedqvist P.","key":"e_1_2_1_17_1"},{"key":"e_1_2_1_18_1","unstructured":"Herlihy M. Luchangco V. and Moir M. 2003. Obstruction-Free synchronization: Double-Ended queues as an example. In Distrib. Comput. Syst. IEEE 522--529. Herlihy M. Luchangco V. and Moir M. 2003. Obstruction-Free synchronization: Double-Ended queues as an example. In Distrib. Comput. Syst. IEEE 522--529."},{"key":"e_1_2_1_19_1","doi-asserted-by":"publisher","DOI":"10.1109\/EUC.2008.181"},{"key":"e_1_2_1_20_1","doi-asserted-by":"publisher","DOI":"10.1145\/582419.582433"},{"key":"e_1_2_1_21_1","doi-asserted-by":"publisher","DOI":"10.1023\/A:1007782300874"},{"key":"e_1_2_1_22_1","doi-asserted-by":"crossref","unstructured":"Ladan-Mozes E. and Shavit N. 2004. An optimistic approach to lock-free fifo queues. Distrib. Comput. 117--131. Ladan-Mozes E. and Shavit N. 2004. An optimistic approach to lock-free fifo queues. Distrib. Comput. 117--131.","DOI":"10.1007\/978-3-540-30186-8_9"},{"key":"e_1_2_1_23_1","doi-asserted-by":"publisher","DOI":"10.1145\/850657.850658"},{"key":"e_1_2_1_24_1","doi-asserted-by":"publisher","DOI":"10.1145\/1291201.1291217"},{"key":"e_1_2_1_25_1","doi-asserted-by":"publisher","DOI":"10.1145\/248052.248106"},{"key":"e_1_2_1_26_1","unstructured":"Matz M. Hubicka J. Jaeger A. and Mitchell M. 2012. System V application binary interface AMD64 architecture processor supplement. http:\/\/www.x86-64.org\/documentation\/abi.pdf. Matz M. Hubicka J. Jaeger A. and Mitchell M. 2012. System V application binary interface AMD64 architecture processor supplement. http:\/\/www.x86-64.org\/documentation\/abi.pdf."},{"key":"e_1_2_1_27_1","doi-asserted-by":"publisher","DOI":"10.1109\/DATE.2005.197"},{"volume-title":"Proceedings of the International Symposium on High Performance Computer Architecture. IEEE, 742--747","author":"Nuth P.","key":"e_1_2_1_28_1"},{"volume-title":"Proceedings of the European Conference on Object Oriented Programming (ECOOP'04)","author":"Onodera T.","key":"e_1_2_1_29_1"},{"volume-title":"Usenix Annual Technical Conference.","year":"1996","author":"Ousterhout J.","key":"e_1_2_1_30_1"},{"key":"e_1_2_1_31_1","unstructured":"Pall M. 2011. The luajit project. http:\/\/luajit.org. Pall M. 2011. The luajit project. http:\/\/luajit.org."},{"key":"e_1_2_1_32_1","doi-asserted-by":"publisher","DOI":"10.1145\/1167515.1167496"},{"key":"e_1_2_1_33_1","doi-asserted-by":"crossref","unstructured":"Schemenauer N. Peters T. and Hetland M. 2001. Pep 255:Simple generators. http:\/\/www.python.org\/dev\/peps\/pep-0255\/. Schemenauer N. Peters T. and Hetland M. 2001. Pep 255:Simple generators. http:\/\/www.python.org\/dev\/peps\/pep-0255\/.","DOI":"10.1353\/pep.2001.0020"},{"key":"e_1_2_1_34_1","doi-asserted-by":"publisher","DOI":"10.5555\/889230"},{"key":"e_1_2_1_35_1","doi-asserted-by":"publisher","DOI":"10.1145\/378580.378611"},{"key":"e_1_2_1_36_1","doi-asserted-by":"publisher","DOI":"10.1145\/1854273.1854287"},{"volume-title":"Conference on Hot Topics in Operating Systems. USENIX Association.","author":"Von Behren R.","key":"e_1_2_1_37_1"},{"key":"e_1_2_1_38_1","doi-asserted-by":"publisher","DOI":"10.1145\/1165389.945471"},{"key":"e_1_2_1_39_1","doi-asserted-by":"publisher","DOI":"10.1145\/165123.165148"},{"key":"e_1_2_1_40_1","doi-asserted-by":"publisher","DOI":"10.1145\/1146909.1147001"}],"container-title":["ACM Transactions on Architecture and Code Optimization"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/2400682.2400695","content-type":"unspecified","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/2400682.2400695","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,6,18]],"date-time":"2025-06-18T09:35:01Z","timestamp":1750239301000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/2400682.2400695"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2013,1]]},"references-count":40,"journal-issue":{"issue":"4","published-print":{"date-parts":[[2013,1]]}},"alternative-id":["10.1145\/2400682.2400695"],"URL":"https:\/\/doi.org\/10.1145\/2400682.2400695","relation":{},"ISSN":["1544-3566","1544-3973"],"issn-type":[{"type":"print","value":"1544-3566"},{"type":"electronic","value":"1544-3973"}],"subject":[],"published":{"date-parts":[[2013,1]]},"assertion":[{"value":"2012-06-01","order":0,"name":"received","label":"Received","group":{"name":"publication_history","label":"Publication History"}},{"value":"2012-10-01","order":1,"name":"accepted","label":"Accepted","group":{"name":"publication_history","label":"Publication History"}},{"value":"2013-01-20","order":2,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}