0

Consider a scenario in kernel where we are initiating some activity outside of the current thread, then waiting for that activity to complete. This kind of synchronization could be well achieved by using semaphores. But, it is considered to be a good practice to use completions instead.

Why are completions preferred over semaphores in such situations?

Completions can be considered as condition variables, and mostly these are implemented using semaphores with a wrapper over it. Is this not true for completions in Linux kernel?

Also, the documentation says completions are better and lightweight than semaphores. How is implementation of completion different from semaphores that adds to these advantages?

user31986
  • 1,558
  • 1
  • 14
  • 29
  • Can you provide a link to the source you found that says completions are considered better practice than semaphores? – Benjamin Leinweber Sep 25 '13 at 07:45
  • http://lwn.net/images/pdf/LDD3/ch05.pdf : Page114 – user31986 Sep 26 '13 at 13:09
  • possible duplicate of [Difference between completion variables and semaphores](http://stackoverflow.com/questions/4764945/difference-between-completion-variables-and-semaphores) – Benjamin Leinweber Sep 26 '13 at 16:24
  • I checked that post prior to posting this. I saw that it is focused on the differences based on the **use-cases**, while my query is regarding the difference in their **design/architecture** in the Linux kernel. Kindly undo the duplicate tag, we can have an answer to the post. – user31986 Sep 26 '13 at 18:32

0 Answers0