aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/DocBook
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-09 18:59:20 -0500
committerIngo Molnar <mingo@hera.kernel.org>2006-01-09 18:59:20 -0500
commitf3f54ffa703c6298240ffd69616451d645bae4d5 (patch)
tree0f66c760d21ab3c94b4f0be4229f458c0a3fd9c2 /Documentation/DocBook
parent6053ee3b32e3437e8c1e72687850f436e779bd49 (diff)
[PATCH] mutex subsystem, documentation
Add mutex design related documentation. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Diffstat (limited to 'Documentation/DocBook')
-rw-r--r--Documentation/DocBook/kernel-locking.tmpl22
1 files changed, 14 insertions, 8 deletions
diff --git a/Documentation/DocBook/kernel-locking.tmpl b/Documentation/DocBook/kernel-locking.tmpl
index 90dc2de8e0a..158ffe9bfad 100644
--- a/Documentation/DocBook/kernel-locking.tmpl
+++ b/Documentation/DocBook/kernel-locking.tmpl
@@ -222,7 +222,7 @@
222 <title>Two Main Types of Kernel Locks: Spinlocks and Semaphores</title> 222 <title>Two Main Types of Kernel Locks: Spinlocks and Semaphores</title>
223 223
224 <para> 224 <para>
225 There are two main types of kernel locks. The fundamental type 225 There are three main types of kernel locks. The fundamental type
226 is the spinlock 226 is the spinlock
227 (<filename class="headerfile">include/asm/spinlock.h</filename>), 227 (<filename class="headerfile">include/asm/spinlock.h</filename>),
228 which is a very simple single-holder lock: if you can't get the 228 which is a very simple single-holder lock: if you can't get the
@@ -230,16 +230,22 @@
230 very small and fast, and can be used anywhere. 230 very small and fast, and can be used anywhere.
231 </para> 231 </para>
232 <para> 232 <para>
233 The second type is a semaphore 233 The second type is a mutex
234 (<filename class="headerfile">include/linux/mutex.h</filename>): it
235 is like a spinlock, but you may block holding a mutex.
236 If you can't lock a mutex, your task will suspend itself, and be woken
237 up when the mutex is released. This means the CPU can do something
238 else while you are waiting. There are many cases when you simply
239 can't sleep (see <xref linkend="sleeping-things"/>), and so have to
240 use a spinlock instead.
241 </para>
242 <para>
243 The third type is a semaphore
234 (<filename class="headerfile">include/asm/semaphore.h</filename>): it 244 (<filename class="headerfile">include/asm/semaphore.h</filename>): it
235 can have more than one holder at any time (the number decided at 245 can have more than one holder at any time (the number decided at
236 initialization time), although it is most commonly used as a 246 initialization time), although it is most commonly used as a
237 single-holder lock (a mutex). If you can't get a semaphore, 247 single-holder lock (a mutex). If you can't get a semaphore, your
238 your task will put itself on the queue, and be woken up when the 248 task will be suspended and later on woken up - just like for mutexes.
239 semaphore is released. This means the CPU will do something
240 else while you are waiting, but there are many cases when you
241 simply can't sleep (see <xref linkend="sleeping-things"/>), and so
242 have to use a spinlock instead.
243 </para> 249 </para>
244 <para> 250 <para>
245 Neither type of lock is recursive: see 251 Neither type of lock is recursive: see