In the context of synchronizing data structures, can someone clarify the difference between “non-blocking” and “non-blocking”? These terms seem to be used interchangeably by many people, but I'm still not sure that somewhere there is some subtle difference.
I mean, locking is “no locking,” and non-locking is more like guaranteeing progress. I suspect that one implies the other, but not vice versa, I'm not sure.
Links are welcome.
- . , , . , / , , , . , , .
, , , . // ( ), , .
Addition--, , . - , ( ) , .
, LOCKING , ( ). , , , , , , .
, .
.
, - . , , , , .
... , , .
3 :
2 IO:
open() read() , IO. IO, O_NONBLOCK open(), read() E_AGAIN .
open()
read()
O_NONBLOCK
E_AGAIN
. fcntl() F_SETLK F_SETLKW, . , , EACCES EAGAIN.
fcntl()
F_SETLK
F_SETLKW
EACCES
EAGAIN
, :
, . , , - (, , ). , ,
flock(fh, LOCK_SH | LOCK_NB);
" , , , , , ". LOCK_SH ( "shared lock" ) LOCK_NB ( "" ) .
LOCK_SH
LOCK_NB
, . . "" -, , (, , ).
, , - . , , , , .
:
( "" ) : wait() notify().
wait()
notify()
1:
notify() . wait() , . , wait() .
2:
notify() , , . wait() , , , , . , , .
3:
. notify() , . wait() boolean true. notify() ( , ). wait() , .
, , , , .
Source: https://habr.com/ru/post/1713755/More articles:Recovering a file from Git? - gitJava: date and time relative to the current (server) time - javaPHP, Smarty: checking a template in different folders - phpAutomatically resize images on A4 in LaTeX - imageIs there a HOSTS file on Symbian Series 60 5th Edition devices? - networkingSent port order sends a running instance to BizTalk - biztalkBest way to design locations within the radius of the starting point - phpC # / LINQ select counting objects with same properties - c #An idempotent barrier to messaging - javaDns.GetHostEntry возвращает неверные IP-адреса в Windows Mobile - c#All Articles