arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2602.19686cs.PLcs.SC
收藏

为Go语言中的死锁检测扩展协程类型

A Flow Extension to Coroutine Types for Deadlock Detection in Go

Macao Polytechnic University(澳门理工大学)

Qiqi Jason Gu, Lixue Liu, Wei Ke

AI总结:

本文提出一种扩展协程类型的方法,用于检测Go语言中因并发使用不当导致的死锁问题,通过类型系统识别通道和协程交互模式,并结合Z3求解器提高检测准确性。

摘要:

协程作为一种抽象编程构造,是函数的泛化,可以部分暂停执行以供以后恢复。协程类型是行为类型,用于建模协程之间的交互,包括一次接收操作后跟一次产生操作。协程类型已被应用于模型驱动工程、智能合约和测试用例生成。我们为协程类型贡献了一个Flow扩展,使得具有多个接收和产生操作的协程可以被建模。我们因此修订了协程类型的约简规则。为了展示Flow扩展的实用性,我们贡献了一个类型系统,将Go编程语言的表达式映射到协程类型。如果约简结果为0,则两个通道操作配对正确,程序无死锁。我们选择Go,因为它是一种用于分布式系统的流行编程语言,但Go中常见的bug类型是由于并发特性使用不当导致的死锁。我们专注于Go中最常用的语义:无缓冲通道以及go和defer关键字。我们的Flow扩展和类型系统识别了17种通道和协程交互模式,包括不匹配的接收器和发送器、嵌套协程等。我们还集成了Z3 SMT求解器以考虑条件执行和类型继承。其他静态或动态死锁检测器在某些模式中崩溃或给出错误预测。因此,我们的基于类型的死锁分析器不仅填补了基于值的检测领域的空白,也补充了现有的检测器。

英文摘要:

Coroutines, as an abstract programming construct, are a generalization of functions that can suspend execution part- way for later resumption. Coroutine Types are behavioral types to model interactions of coroutines with a single receiving operation followed by a single yielding operation. Coroutine Types have been applied to model-driven engineering, smart contracts, and test case generation. We contribute a Flow extension to Coroutine Types, so that coroutines with more than one receiving and yielding operation can be modeled. We accordingly revise the reduction rules of Coroutine Types. To show the usefulness of the Flow extension, we contribute a type system that maps expressions of the Go programming language to Coroutine Types. If the reduction result is 0, the two channel operations are paired properly and the program has no deadlocks. We choose Go because it is a popular programming language for distributed systems, but a frequent kind of bugs in Go is deadlocks due to the wrong use of concurrency features. We concentrate on the most commonly used semantics in Go: unbuffered channels with the keywords go and defer. Our Flow extension and the type system recognize 17 patterns of channels and goroutine interactions, including mismatched receivers and senders, nested goroutines, etc. We also integrate the Z3 SMT solver to take account of conditional execution and type inheritance. Other static or dynamic deadlock detectors crashed or gave wrong predictions in some patterns. Therefore, our type-based deadlock analyzer not only fills the gap in the landscape of value-based detection, but also complements existing detectors.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑