search

Home  >  Q&A  >  body text

java - 乐观锁和悲观锁的概念是否仅限于关系型数据库?

维基百科上,对于乐观锁和悲观锁的定义是限定在关系型数据库上的。
但是在语言层面上,比如java,是否有这样的概念?实现都有什么呢?

天蓬老师天蓬老师2768 days ago698

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 13:08:39

    The concept of "lock" is not limited to a specific language implementation. He feels that it is more appropriate to accompany the multi-threading model.
    The shadow of locks will be seen wherever critical resource access is involved. Optimistic locking and pessimistic locking are just two more detailed models of locks. The mysql database is implemented in C language. It also involves multiple threads accessing a data at the same time, two people writing at the same time, one person writing and one reading, two people reading at the same time, etc. So locks are not limited to relational databases.

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 13:08:39

    Concurrent reading and writing of any resource can have "locks".

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 13:08:39

    I’m not sure whether Java multi-threading locks exist

    reply
    0
  • Cancelreply