multithreading - What is purpose of Read Lock in java synchronization -


i new in multithreading , confused , why read lock needed in java synchronization .also understand use case of write lock.in scenario need limit reader access threads. suppose don't have read lock in java , what's problem.

suppose there shared resource r. thread t1 reading , it's not locked there no read lock in java(as said)meanwhile second thread try access r1 write on it. there in no information attached r1 thread read , second thread write lock , start writing not aspected. read lock information attached resource tell later threads resource in access reading , wait write access or can access read. read lock can access multiple thread.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -