Automatic Resolution of Deadlocks in Concurrent Programs

It is no longer possible to improve CPU performance by increasing clock speeds and cache sizes, at the rate it once was, due to heat generation becoming too high. Thus, CPU manufacturers resorted to improving performance through others means such as hyper- threading and multi-core architectures. The...

Full description

Bibliographic Details
Main Author: Almeida, Afonso José Figueiras Ribeiro Simões de (author)
Format: masterThesis
Language:eng
Published: 2022
Subjects:
Online Access:http://hdl.handle.net/10362/138810
Country:Portugal
Oai:oai:run.unl.pt:10362/138810
Description
Summary:It is no longer possible to improve CPU performance by increasing clock speeds and cache sizes, at the rate it once was, due to heat generation becoming too high. Thus, CPU manufacturers resorted to improving performance through others means such as hyper- threading and multi-core architectures. The use of concurrent programming has been on a steady rise to make full use of modern hardware. However, concurrent program- ming is considerably harder to grasp than its sequential counterpart. Humans naturally think sequentially, which makes this method of programming notoriously difficult. At a sufficiently large scale, it is hard to reason about interaction between processes, often leading to the introduction of errors that are hard to detect. This results in programs being unknowingly unsafe. A particular case of concurrency errors are deadlocks, which occur when a program reaches a state where two or more threads prevent each other from accessing a shared resource, effectively blocking the program permanently. Deadlocks are hard to debug because their cause may not be easily identified, and because it is difficult to reliably reproduce them, due to the wide range of execution possibilities. Despite being difficult to develop and debug concurrent programs, there is a lack of tools and mechanisms to help the user detect and fix deadlocks. Go, a programming language that employs a message passing concurrency model, in addition to a shared memory model, can detect, at runtime, cases where all the threads are blocked. However, it does not auto- matically fix the error or provide a suggestion of a solution. To the best of our knowledge, there are no automatic deadlock resolution tools for Go, despite there being multiple deadlock detection tools. As such, to bridge this gap, this work proposes a proof of con- cept tool that statically detects deadlocks in Go and automatically fixes some of them. It uses another existing tool to extract the communication protocol of a Go program, which is then translated to CCS processes and solved. To do this, existing deadlock detection and resolution algorithms were extended and implemented.