In the shared variable model of concurrency, guarded atomic actions restrict the possible interference between processes by regions of atomic execution. The guard specifies the condition for entering an atomic region. That is a convenient model for the specification and verification of concurrent programs, but has eschewed efficient execution so far. This article shows how guarded atomic actions, when attached to objects, can be implemented highly efficiently using a combination of coroutines, operating-system worker threads, and dedicated management of object queues and stacks. The efficiency of an experimental language, Lime, is shown to compare favourably with that of C/Pthreads, Go, Erlang, Java, and Haskell on synthetic benchmarks.
翻译:在共享变量并发模型中,守卫原子操作通过原子执行区域限制进程间可能发生的干扰。守卫规定了进入原子区域的条件。该模型为并发程序的规范描述与验证提供了便利,但迄今为止一直未能实现高效执行。本文展示了当守卫原子操作与对象关联时,如何通过协程、操作系统工作线程以及对象队列与栈的专用管理相结合的方式实现高效执行。实验性语言Lime在合成基准测试中表现出色,其效率优于C/Pthreads、Go、Erlang、Java和Haskell。