4.1 Framework
sequence使用在asynchronous message passing上面,經過
asynchronous message passing filter會留下不同的race variants,如下圖。
non-blocking send + blocking receive Filter 過濾 經過
。
過濾
主要針對 multiple receiver 所輸入的 SYN-sequence,由圖知道有兩個 receiver 分別為 T1 和 T3,有六個 unique message ID 組成 SYN-sequence,針對所收到的 SYN-sequence 我們丟入 race analysis 產生 RV。
我們此實驗都會根據 multiple receiver 所輸入的 SYN-sequence 產生的 RV 分 別由 synchronous message passing filter 和 asynchronous message passing filter 做實 驗。
4.2 實驗數據 實驗數據 實驗數據 實驗數據
T2_s_1_P1 T1_r_1_P1 T0_s_1_P1 T1_r_2_P1 T4_s_1_P1
T3_r_1_P1
圖.50 SYN-sequence
根據以上的 SYN-sequence(圖.50 SYN-sequence)來做實驗,我們可以得知產 生 114 個相異的 race variant,經過 race variant filter 之後,可以得到 asynchronous message passing 97 個 RV,synchronous message passing 7 個 RV。Synchronous message passing 使用的 race table 所產生的 RV 相異的個數是一樣的。
r1 race(r1) = s2,s3
race(r3) = s2 race(r2) ={}
圖.52 不同先後順序的 receiving event 所得到的 race table 之二
r3 r1 先後順序的 receiving event 所得到的 race table 之二、圖.53 不同先後順序的 receiving event 所得到的 race table 之三使用很多的 race table 去解決 multiple receiver 的問題(synchronous message passing),主要針對 receiving event 各種可能 的結果下去做的,我們得到 9 個 race variants,7 個相異的 race variants,跟我們 以下所實驗我們的方法的結果是一樣的。
根據 Richard H. Carver 所提供的演算法(圖.13)做為基礎,此演算方法主要解 決 synchronous message passing of multiple receiver 所造成 receiving event 有 parallel 的現象,parallel SYN-sequence 是由 multiple receiver 所得到有數個 receiving event 的 timestamp 所稱之,我們得出一個新的演算方法如下圖:
Algorithm 8 : Generate race variants of race tables of a parallel SYN-sequence
Input: A parallel SYN-sequence that contains two types of synchronization events:
send and receive.
Let Non-assign-Seq is a sequence which is generated from topological sort.
Output: race variants’ queue Qv of race tables of multiple receiver
(1) Generate all of the topological order sequences of receiving event of a parallel SYN-sequence and store the sequences Non-assign-Seq to a queue Qs.
(2) For every Non-assign-Seq form Qs to algorithm 9 to get SYN-sequences and store the SYN-sequences to queue QSYN.
(3) For SYN-sequence from QSYN use Coustruct-Race-Table algorithm(圖.13) to get race tables
(4) For every race table derives race variants and store distinct race variants to queue Qv.
圖.54 Algorithm 8
Algorithm 9: Generate a SYN-sequence
Input: Non-assign-Seq
Output: a total order SYN-sequence using timestamp
(1) Combine the vector clock of the receiver of a Non-assign-Seq and assign the new total order timestamp to the vector clock of receivers.
(2) Update the acknowledge vector timestamp clock of send events.
圖. 55 Algorithm 9
另外針對 asynchronous message passing model 得到的 race variants 比使用
許多的 race variant,原因是
Filtered race variants Type of SYN-sequence
asynchronous message passing model 我們使用一樣的 SYN-比使用 Yu Lei 所提出的方法得到兩個 race variant[17]
原因是 Yu Lei 他所測的 program 的模式是針對每個 thread,所以說有兩個以上的 receiver 並不能競爭
這種情況就是 single receiver 的情況,而我們可以針對 receiver(multiple receiver)去競爭 sending event 所送出的 message
個數比起 single receiver 多出許多,情況也複雜許多
Synchronous Filtered race variants
-sequence
Table.
23
17611797 milliseconds
32473
17601375 milliseconds
Table.1 SYN-sequence 實驗結果
34323
5. 結論與未來展望 結論與未來展望 結論與未來展望 結論與未來展望
5.1 結論 結論 結論 結論
根據 Richard H. Carver 他們所使用的 timestamp assignment scheme 會發生
thread event 平行的現象,而沒辦法解決 multiple receiver 的情況(因為 race set 找 出來的個數不對),但是我們卻使用了 Unique message ID 來完成,因為 blocking
receive 所以 receiver 端一定會收到 unique message ID,再透過 race analyzer 做 race
variant 分析,透過 race variant filter 過濾不符合 message passing model 的 race
variant(synchronous message passing 和 asynchronous message passing),所得到的
race variant 正式符合 message passing 模型,timestamp assignment scheme 必須要 先知道有多少個 thread,透過 Unique Message ID 的話,便不需要知道有多少個
thread 執行,而且經過 filter 把不合法的 race variant 拿掉,可以提高程式回放的 正確性,不會讓程式停擺,此技術可以 porting 到分散式架構上去做測試,不過
此篇沒有寫 socket programming,只有在單機上做 thread 之間透過 port 做訊息交
換測試,所以未來可以往這方面去著手,此論文並沒有實做完整個 reachability
testing 完整過程,在 prefix-based replay 方面必須往 send protocol 和 receive protocol 方面著手,之前 read protocol 和 write protocol 有所限制是不一樣的,必須考慮
到 synchronous port 和 asynchronous port 的型態,不過我們可以知道透過找出所
有可能的拓樸排序必須花費很大的時間,因為我們必須把所有可能的 parallel
event 先後順序都找出來,產生所有的 total order,再丟到 race analysis 做分析,
產生 race variant,過濾掉很多不符合模型的 race variant,所得到的 race variant
便是針對可解 multiple receiver 所產生的 race variant,並且我們發現排序所有的
parallel receiving event,使用很多的 race table 可以解決 synchronous message
passing 的 multiple receiver 的問題,跟我們的解法得到結果是一樣的。至於
asynchronous message passing 的 multiple receiver 問題,Yu Lei[17]所提出的架構 還是在 single receiver 上面,因為我們的解法針對所有可能的 parallel event 做排
序,會產生 asynchronous message passing multiple receiver 的 race variants,主要
針對的方向(single receiver vs. multiple receiver )是不一樣的,至於 Yu lei 的方式是
否可以像 Richard H. Carver 一樣可以做修改成 multiple receiver 的方法,因為做
法不相同,針對所測試的 program model 也不一樣,還要進一步的探討。
5.2 未來展望 未來展望 未來展望 未來展望
目前 testing 的技術還有很多方面有待改進,此篇主要著墨在 blocking send
blocking receive model 和 non-blocking send blocking receive model 上面,還有兩 種模式 blocking send non-blocking receive 和 non-blocking send non-blocking
receive,針對 receive 不到時該怎麼做個狀況的處理,這些也都是可行的方向。
如果遇到 message passing 的 infinite loop 時,就要加入 Dynamic Effective
Testing(DET)的功能,若我們要測分散式的系統架構,因為每個 port 或是 channel 都有 over flow 的情形會發生,所以如何測出 buffer overflow 也是一個課題。不
過不管怎麼說,測試總是一個很難的學問,考驗人類的智慧,最終大家還是得往
一個通用的解法去思考。
6. REFERENCES
[1] G. H. Hwang, K.C. Tai, and T.L. Huang, "Reachability Testing: An
Approach To Testing Concurrent Software", Int’l J. Software Eng.
and Knowledge Eng., vol. 5, no. 4, pp. 493-510, Dec. 1995.
[2] Abraham Silberschatz, Peter Baer Galvin, and Greg Gagne,"Operating System
Concepts", John Wiley & Sons, ISBN: 0471417432, 6th edition (June 26, 2001).
[3] K.C. Tai and Richard H. Carver,"Testing of Distributed Programs", Chapter 33 in
Parallel and Distributed Computing Handbook, editor A. Y. Zomaya,
McGraw-Hill, 1996.
[4] Gwan-Hwan Hwang, Sheng-Jen Chang, and Huey-Der Chu, "Technology for
Testing Nondeterministic Client/Server Database Applications", IEEE
Transaction on Software Engineering, Volume 30, Number 1, pp. 59-77, Jan.,
2004.
[5] Richard H. Carver and Yu Lei, “A General Model for Reachability Testing of
Concurrent Programs,” ICFEM 2004, LNCS 3308, pp. 76-89, 200S. Y. Hsu and C.
G. Chung,"A heuristic approach to path selection problem in concurrent program
testing", Proc. 3rd IEEE Workshop on Future Trends of Distributed Computing
System(1992) pp. 86-92.
[6] K. C. Tai, R. H. Carver, "Use of sequencing constraints for specifying, testing and
debugging concurrent programs", Proc. 1994 Int. Conf. Parallel and Distributed
Systems (December 1994) pp. 280-287.
[7] R. N. Taylor, D. L. Levine, and C. D. Kelly, "Structural testing of concurrent
programs", IEEE Trans. Softw. Eng. 18,3(1992) 206-215,
[8] R. D. Yang and C.G. Chung, "Path analysis testing of concurrent
programs",Information and Software Technology 34, 1(1992) 43-56.
[9] Richard N. Taylor, "A General-Purpose Algorithm for Analyzing Concurrent
Programs", Communication of the ACM, Volume 21, Number 7, July 1978.
[10] Michael Young and Richard N. Taylor, "Combining Static Concurrency
Analysis with Symbolic Execution", IEEE Transaction on Software Engineering,
Volume 14, Number 10, October 1988.
[11] Yu Lei and Richard H. Carver, "Reachability Testing of Concurrent Programs,"
IEEE Transaction on Software Engineering, June 2006 (Vol. 32, No. 6) pp.
382-403Yu Lei, Member, IEEE, and Richard H. , Reachability Testing of
Semaphore-based Programs, COMPSAC’04
[12] J. Burch, E. Clarke, K. McMillan, D. Dill, and L. Hwang. Symbolic model
checking: 1020 states and beyond. In IEEE Symposium on Logic in Computer
Science, pages 428-439, 1990.
[13] JavePathFinder page, http://javapathfinder.sourceforge.net/.
[14] A. Pnueli. A temporal logic of concurrent programs.
[15] Jun Chen, Steve MacDonald ,"Testing Concurrent Programs using Value
Schedules",ASE’07.November 5-9,2007.
[16] D. Helmbold and D. Luckham, “Debugging Ada tasking programs,” IEEE
Software, Volume 2, Number 2, 66-74,1985
[17] Yu Lei and Kuo-Chung Tai, “Efficient Reachability Testing of Asynchronous
Message-Passing Programs,”Proc. 8th IEEE Intl. Conf. on Engineering for
Complex Computer Systems, pp. 35-44, Dec. 2002.
[18] L. Lamport, “Time, Clocks, and the Ordering of Events in a Distributed System,”
Comm. ACM, vol. 21, no. 7, pp.558-565, July 1978
[19] Richard N. Taylor, “A General-Purpose Algorithm for Analyzing Concurrent
Programs,” Communication of the ACM, Volume 21, Number 7, July 1978.
[20] Yu Lei and Richard H. Carver, “Reachability testing of semaphore-based
programs”, to be published in Proc. of the 28th Computer Software and
Applications Conference (COMPSAC), September, 2004.
[21] J.-D. Choi and H. Srinivasan, "Deterministic Replay of Java Multithreaded
Applications," Proc. of the SIGMETRICS Symposium on Parallel and
Distributed Tools, pp. 48-59, 1998