跳到主要内容

竞态条件分析

                                               Required Predecessors
---------------------
Reference # Action Initiator "Proferred" Proposed
----------- ------ --------- ----------- --------
1 Listen(L,32) Server -- --

2 Init(U,L,32) User -- --

3 RTS(U,L,'l') UNCP 2 2

4 STR(L,U,32) SNCP 1 and 3 1 and 3

5 Send(L,S) Server 4 4

6 SEND('l',S) SNCP 5 5

7 RECEIVE('l',S) UNCP 6 6

8 Receive(U,S) User 7 7

9 Close(L) Server 5 5

10 CLS(L,U) SNCP 9 and 7 9 and 7

11 Close(U) User 8 not used

12 CLS(U,L) UNCP 11 10
                                               Required Predecessors
---------------------
Reference # Action Initiator "Proferred" Proposed
----------- ------ --------- ----------- --------

13 Init(S,U+1,B ) Server 9 9
u

14 RTS(S,U+1,'l' ) SNCP 13 13
2

15 Init(S+1,U,B ) Server 13 14 and 18
s

16 STR(S+1,U,B ) SNCP 15 15
s

17 Init(U+1,S,B ) User 11 12
u

18 STR(U+1,S,B ) UNCP 17 17
u

19 Init(U,S+1,B ) User 17 17
s

20 RTS(U,S+1,'l' ) UNCP 19 19
3

注意, 在 Proferred Order (原提议顺序) 一列中, 16 可以发生在 12 之前, 此时 UNCP 会发现套接字 U 正在使用中, 并很可能返回一个 CLS (U,S+1)。服务器随后就很可能会认为用户已经结束了本次会话。