equal
deleted
inserted
replaced
34 For a small number of processors, we only need a small number of locks, each |
34 For a small number of processors, we only need a small number of locks, each |
35 covering a large region of the OS. This model of coarse-grained locking provides |
35 covering a large region of the OS. This model of coarse-grained locking provides |
36 good scaling on small numbers of processors.</p><fig id="GUID-D70A45BC-E281-403E-9D7F-519D990F0DAE"> |
36 good scaling on small numbers of processors.</p><fig id="GUID-D70A45BC-E281-403E-9D7F-519D990F0DAE"> |
37 <title>Coarse-Grained Lock</title> |
37 <title>Coarse-Grained Lock</title> |
38 <desc/> |
38 <desc/> |
39 <image href="GUID-91BD4E81-4CDC-4279-8E19-5B79A63B838E_d0e16923_href.png" placement="inline"/> |
39 <image href="GUID-91BD4E81-4CDC-4279-8E19-5B79A63B838E_d0e17222_href.png" placement="inline"/> |
40 </fig><ul> |
40 </fig><ul> |
41 <li><p><b>Fine-Grained Locks</b> enclose a small area of code for example |
41 <li><p><b>Fine-Grained Locks</b> enclose a small area of code for example |
42 a data structure. These locks are added to the code and the user must remember |
42 a data structure. These locks are added to the code and the user must remember |
43 to release the lock. Fine locks are error prone. </p></li> |
43 to release the lock. Fine locks are error prone. </p></li> |
44 </ul><p>As the number of processors increases, the number of locks also increases. |
44 </ul><p>As the number of processors increases, the number of locks also increases. |
47 structures. All those locks add instructions and data. To do this, we divide |
47 structures. All those locks add instructions and data. To do this, we divide |
48 the OS into sections and divide the section into small pieces of code and |
48 the OS into sections and divide the section into small pieces of code and |
49 apply lock for each piece of code. Fine-grained locking can result in near |
49 apply lock for each piece of code. Fine-grained locking can result in near |
50 perfect scaling.</p><fig id="GUID-97F40770-1B6C-435B-AFF0-3BA3AC66F7DA"> |
50 perfect scaling.</p><fig id="GUID-97F40770-1B6C-435B-AFF0-3BA3AC66F7DA"> |
51 <title>Fine-Grained Lock</title> |
51 <title>Fine-Grained Lock</title> |
52 <image href="GUID-2E3F9FBD-21FE-4F02-B410-F756012805D2_d0e16940_href.png" placement="inline"/> |
52 <image href="GUID-2E3F9FBD-21FE-4F02-B410-F756012805D2_d0e17239_href.png" placement="inline"/> |
53 </fig></section> |
53 </fig></section> |
54 <section id="GUID-94FDD42D-9D26-4A41-BFB6-57648083EC41"><title>Type of Locks</title><ul> |
54 <section id="GUID-94FDD42D-9D26-4A41-BFB6-57648083EC41"><title>Type of Locks</title><ul> |
55 <li><p><xref href="GUID-FB1605A8-9946-364C-A649-DEF60E1F761B.dita"><apiname>TSpinLock</apiname></xref> is the lightest weight lock available |
55 <li><p><xref href="GUID-FB1605A8-9946-364C-A649-DEF60E1F761B.dita"><apiname>TSpinLock</apiname></xref> is the lightest weight lock available |
56 kernel side. If a process attempts to acquire a spinlock and one is not available, |
56 kernel side. If a process attempts to acquire a spinlock and one is not available, |
57 the process will keep trying (spinning) until it can acquire the lock. Spinlocks |
57 the process will keep trying (spinning) until it can acquire the lock. Spinlocks |