.


:




:

































 

 

 

 


5.




, . , , . - ? ? .

Interleaving, race condition

, . , . , . . , :

    1. .
    2. .
    3. .
    4. .

( , , ). , , , .

P: a b c
Q: d e f,

a, b, c, d, e, f . :

PQ: a b c d e f

, ? , , interleaving. :

b c d e f
a b d c e f
a b d e c f
a b d e f c
a d b c e f
......
d e f a b c

. , . . P Q, :

P: x=2 Q: x=3
  y=x-1   y=x+1

, x y ? , (x, y): (3, 4), (2, 1), (2, 3) (3, 2). , (, ) , . . . , . .

( ) , race condition ( , ). x y.

( race condition), , , , . , , , . (mutual exclusion). , .

(critical section) . - , race condition. , , , . , . , , , . , :

1 2 3
17-05    
17-07 ,    
17-09    
17-11    
17-13   ,  
17-15    
17-17    
17-19     ,
17-21    
17-23    
17-25 2    
17-27    
17-29    
17-31   2  
17-33    
17-35    
17-37     2
17-39    
17-41    
17-43      
17-45      
17-47    
17-49      
17-51      
17-53    

, . . 2 , .

1 2 3
17-05    
17-07    
17-43    
17-47    

: , . , .

, , , , . , (entry section) - (exit section) , . , , , - , .

, , :

while (some condition) {

entry section

critical section

exit section

remainder section

}

remainder section , .

.





:


: 2016-10-23; !; : 531 |


:

:

, - , ; , - .
==> ...

1198 - | 1232 -


© 2015-2024 lektsii.org - -

: 0.011 .