linux - The advantages of read_lock and write_lock -


i studying read_lock , write_lock.

it seems can use spin_lock instead of read-write lock.

so wondering there advantages use read-write lock

when use read_lock , write_lock, advantages using spin_lock?

short googling turned paragraph up:

sometimes, lock usage can divided readers , writers. example, consider list both updated , searched. when list updated (written to), important no other threads of execution concurrently write or read list. writing demands mutual exclusion. on other hand, when list searched (read from), important nothing else write list. multiple concurrent readers safe long there no writers. task list's access patterns (discussed in chapter 3, "process management") fit description. not surprisingly, task list protected reader-writer spin lock.

(source: link)

so basically, using read_lock/write_lock gives more power regular spinlocks deny/allow different lock-users, depending on needs, in above example.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -