摘要: | “Multithreading Is Today′s GOTO” - Jos de Jong 2013 隨著硬體以及軟體架構的發展,加上人們對於效能的需求,多執行緒或是所謂的並行程式 已經成為一種無可避免的趨勢,無論是遊戲,伺服器甚至是手機端程式,都對 CPU 效能有所 需求。但是程式語言的發展是早於多執行緒的概念的,既有的程式語言多半是增加了對多執行 緒能力的支援,卻無法避免掉它們帶來的錯誤,舉凡最簡單的 data race 到複雜難以發現 的 atomic variable memory ordering 導致的錯誤,這些問題在根本上需要相對應的 知識才得以避免,也需要等值的經驗才有辦法除錯,也就是說,處理多執行緒程式是一件難事, 不論使用的語言為何。 是的,除錯很難,除多執行緒程式的錯更是難上加難,為了輔助既有程式語言以及對多執 行緒程式的除錯,開發者需要仰賴工具來協助它們,而當中的其中一個幫手便是 data race detector。 本 研 究 提 出 了 一 個 建 立 在 實 驗 室 專 案 , XThreadDebugger , 上 的 dynamic race detector。藉由搭配 XThreadDebugger 提供的 exhaustive testing,來對待測程式 進行更高覆蓋率的測試,藉此偵測更多的 data race,作為一個對過去 race detector 的新嘗試。實作方面,XThreadDebugger 使用中斷點來對程式碼進行 interleaving 的 控制,本研究也將善用這點,在動態時期針對真正有被共享的變數去進行監控,藉此達到偵測 data race 的功能,同時減少不必要的效能開銷。而在架構方面,本研究則提出了 Module 層的概念,提供 XThreadDebugger 未來開發者一個適合且低成本的框架,以便未來開發之 需求,我們所提出的 data race detector 便是在該框架下建構的。;“Multithreading Is Today′s GOTO” - Jos de Jong 2013 Concurrency programming paradigm is the trend, not only because people′s need for performance, but the evolution of hardware as well. From video games industry, server to even mobile application, they all benefit from it. But the history of programming language is earlier than the concept of parallel programming. Even thought most of language got the ability to write parallel code, it’s still hard to avoid the complexity. To solve them the developers require certain knowledge and experience. In the other word, dealing with parallel program is tough no mater which language you use. Debugging is hard, debugging parallel program is even harder. To assist the debugging process developers need tools. Race detector is one of them. This research proposes a dynamic race detector which builds on XThreadDebugger, a tool to help developers debugging thread related problem which was developed by our lab. Combine with the “exhaustive testing” ability from XThreadDebugger, we expect to run tests with higher testing coverage and capture more data race at run time. |