What's the difference between an exclusive lock and a shared lock?

前端 未结 4 1346
终归单人心
终归单人心 2021-01-29 17:08

According to wikipedia,

Shared locks are sometimes called \"read locks\" and exclusive locks are sometimes called \"write locks\".

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-29 18:03

    • An exclusive or write lock gives a process exclusive access for writing to the specified part of the file. While a write lock is in place, no other process can lock that part of the file.

    • A shared or read lock prohibits any other process from requesting a write lock on the specified part of the file. However, other processes can request read locks.

    More on that : http://www.gnu.org/software/libc/manual/html_node/File-Locks.html

提交回复
热议问题