<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Slava Oks's WebLog : SQL Server Scheduling</title><link>http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Scheduling/default.aspx</link><description>Tags: SQL Server Scheduling</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>SQLOSDMV's Continue</title><link>http://blogs.msdn.com/slavao/archive/2006/11/14/sqlosdmv-s-continue.aspx</link><pubDate>Tue, 14 Nov 2006 21:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1076371</guid><dc:creator>slavao</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/slavao/comments/1076371.aspx</comments><wfw:commentRss>http://blogs.msdn.com/slavao/commentrss.aspx?PostID=1076371</wfw:commentRss><wfw:comment>http://blogs.msdn.com/slavao/rsscomments.aspx?PostID=1076371</wfw:comment><description>sys.dm_os_waiting_tasks One can run lots of interesting queries using this view. You can even use this view to perform deadlock detection that is not resolvable by deadlock monitor, DM. For example if you have tasks waiting on external resources such...(&lt;a href="http://blogs.msdn.com/slavao/archive/2006/11/14/sqlosdmv-s-continue.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1076371" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Scheduling/default.aspx">SQL Server Scheduling</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQLOS_2700_s+DMVs/default.aspx">SQLOS's DMVs</category></item><item><title>SQLOS's DMVs Continue</title><link>http://blogs.msdn.com/slavao/archive/2006/09/28/776437.aspx</link><pubDate>Fri, 29 Sep 2006 05:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:776437</guid><dc:creator>slavao</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/slavao/comments/776437.aspx</comments><wfw:commentRss>http://blogs.msdn.com/slavao/commentrss.aspx?PostID=776437</wfw:commentRss><wfw:comment>http://blogs.msdn.com/slavao/rsscomments.aspx?PostID=776437</wfw:comment><description>sys.dm_os_schedulers Q. Do I need to by more CPUs? In order to answer this question you have to find out if your load is really CPU bounded. Your load is really CPU bounded if a number of runnable tasks per each scheduler always greater than 1 and all...(&lt;a href="http://blogs.msdn.com/slavao/archive/2006/09/28/776437.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=776437" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Scheduling/default.aspx">SQL Server Scheduling</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQLOS/default.aspx">SQLOS</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQLOS_2700_s+DMVs/default.aspx">SQLOS's DMVs</category></item><item><title>Talking points around SQL Server 2005 scalability </title><link>http://blogs.msdn.com/slavao/archive/2006/08/03/687625.aspx</link><pubDate>Thu, 03 Aug 2006 18:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:687625</guid><dc:creator>slavao</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/slavao/comments/687625.aspx</comments><wfw:commentRss>http://blogs.msdn.com/slavao/commentrss.aspx?PostID=687625</wfw:commentRss><wfw:comment>http://blogs.msdn.com/slavao/rsscomments.aspx?PostID=687625</wfw:comment><description>Couple of weeks ago I did a talk on SQL Server 2005 scalability. The actual talk was not about the enormous amount of features that you can leverage in SQL Serve 2005 to make your application scale but rather how SQL 2005 achieves its scalability. In...(&lt;a href="http://blogs.msdn.com/slavao/archive/2006/08/03/687625.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=687625" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Memory+Management/default.aspx">SQL Server Memory Management</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Scheduling/default.aspx">SQL Server Scheduling</category></item><item><title>Set of new features in SQL Server 2005 enabled by SQLOS</title><link>http://blogs.msdn.com/slavao/archive/2006/04/12/575185.aspx</link><pubDate>Wed, 12 Apr 2006 21:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:575185</guid><dc:creator>slavao</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/slavao/comments/575185.aspx</comments><wfw:commentRss>http://blogs.msdn.com/slavao/commentrss.aspx?PostID=575185</wfw:commentRss><wfw:comment>http://blogs.msdn.com/slavao/rsscomments.aspx?PostID=575185</wfw:comment><description>Couple of weeks ago I had a chance to visit set of our customers and talk to them directly. It was an unforgettable experience. As a part of the visit I made set of presentations related to SQLOS and new features it enables in SQL Server 2005. I thought...(&lt;a href="http://blogs.msdn.com/slavao/archive/2006/04/12/575185.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=575185" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Memory+Management/default.aspx">SQL Server Memory Management</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Scheduling/default.aspx">SQL Server Scheduling</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQLOS/default.aspx">SQLOS</category></item><item><title>Be aware: To Hyper or not to Hyper</title><link>http://blogs.msdn.com/slavao/archive/2005/11/12/492119.aspx</link><pubDate>Sat, 12 Nov 2005 20:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:492119</guid><dc:creator>slavao</dc:creator><slash:comments>35</slash:comments><comments>http://blogs.msdn.com/slavao/comments/492119.aspx</comments><wfw:commentRss>http://blogs.msdn.com/slavao/commentrss.aspx?PostID=492119</wfw:commentRss><wfw:comment>http://blogs.msdn.com/slavao/rsscomments.aspx?PostID=492119</wfw:comment><description>Our customers observed very interesting behavior on high end Hyperthreading (HT) enabled hardware. They noticed that in some cases when high load is applied SQL Server CPU usage increases significantly but SQL Server performance degrades. Occasionally they would also see message in errorlog indicating one of the threads can't acquire a spinlock (Spinlock is a lightweight synchronization data structure. Threads keep a spinlock for short period of time. If a thread can't acquire a spinlock it will spin in a tight loop waiting for spinlock to become available). Customers also noticed that when HT is disabled under the same circumstances CPU usage increases slightly and performance is at appropriate level.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;What is going on here? 
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;After some pondering and investigation we came up with the following theory.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Database server has different type of threads: worker threads, threads executing clients request, and system threads that performing system tasks. An example of a system thread is a lazywriter. The responsibility of the lazywriter is to lazily scan through database buffers and push least recently used buffers out of the cache.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Lazywriter usually kicks in whenever data page cache is full and server short of free data page buffers. The interesting behavior of lazywriter is that it scans large amount of memory. With Intel HT technogolgy logical processors share L1 &amp;amp; L2 caches. As you would guess lazywriter's behavior can potentially trash L1 &amp;amp; L2 caches. If a worker thread end up running on logical CPU that shares physical CPU with lazywriter its cache will be constantly trashed.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It means that most of the memory accesses for the worker thread will be L1 &amp;amp; L2 misses. Moreover whenever the worker attempts to access hot data structure protected by spinlock it potentially might have a less chance of acquiring the spinlock which will cause the worker's spinning. This behavior will translate to high CPU utilization and significant drop in performance.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;To confirm the theory I decided to create an experiment. I wrote a test program which consist of two types of threads: scan threads and lock threads. Scan threads are scanning through large amounts of memory. Lock threads&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;constantly attempt to acquire global lock.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If the theory is correct a lock thread that shares a physical CPU with a scan thread should acquire lock much less often than other threads in a given period of time. Below is the program's listing. (Disclosure: The program is for illustrative purpose only, it was written to illustrate the observed behavior, it shouldn't be treated as a final-well tested product :-))&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;#include &amp;lt;windows.h&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;#include &amp;lt;eh.h&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;#include &amp;lt;wtypes.h&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;#include &amp;lt;locale.h&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;#include &amp;lt;process.h&amp;gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;extern "C" void _mm_pause(void);&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;#pragma intrinsic (_mm_pause)&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;inline void&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;SmtPause ()&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;#if defined (_X86_) || defined (_AMD64_)&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;// PAUSE instruction (REP NOP) helps SMT scheduling&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;_mm_pause ();&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;#endif // _X86_&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Statistic information for threads&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;struct Statistics&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;int&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;locked;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;int&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;spinned;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;DWORD_PTR&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;affinity;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;};&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Type of threads the tests using&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;enum ThreadTypes&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;SCAN_THREAD,&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;LOCK_THREAD,&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;LAST_THREAD&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;};&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Entry Point&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;typedef void( __cdecl *ThreadEntryPoint )( void * );&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Inforamtion per thread - enables us to create threads in a common way&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;struct ThreadInfo&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;ThreadEntryPoint&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;func;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;LONG_PTR&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;affinity;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;};&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Global constants&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Number of CPUs&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;const int&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;MaxNumberOfCPUs = 64;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Block of memory to scan by scan thread&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;char&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;MemoryBlock [1024 *1024];&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Stat information: number of threads is limmited by number of CPU, &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// that is the purpose of the test&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;volatile Statistics&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Stats [MaxNumberOfCPUs];&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Number of threads running&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;volatile long&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;NumberOfThreadsRunning = 0;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// "Spinlock" that all lock threads attempt to acquire&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;volatile long&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Lock = 0;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//-----------------------------------------------------------------------------&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Function: scanThread&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Description:&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Attempt to invalidate caches&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Notes:&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;1. Function changes 1MB of contiguous vm memory which appear&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;to be enought invalidate L1&amp;amp;L2 caches&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;void __cdecl &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;scanThread (void* param)&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;char i = 0;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;ULONG_PTR&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;threadAffinity =(DWORD_PTR) param;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;long&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;threadId = InterlockedIncrement (&amp;amp;NumberOfThreadsRunning) -1;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;SetThreadAffinityMask (GetCurrentThread (),threadAffinity);&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;// Initialize affinity&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;Stats [threadId].affinity = threadAffinity;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;while (i &amp;gt;= 0)&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;// Memset memory: quick and dirty scan&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;memset (MemoryBlock, 0, sizeof (MemoryBlock));&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;Stats [threadId].spinned++;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;return;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;//-----------------------------------------------------------------------------&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Function: lockThread&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Description:&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Acquires and releases a lock in a loop&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Notes:&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;void __cdecl &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;lockThread (void* param)&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ULONG_PTR&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;threadAffinity =(DWORD_PTR) param;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;long&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;threadId = InterlockedIncrement (&amp;amp;NumberOfThreadsRunning)-1;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;SetThreadAffinityMask (GetCurrentThread (), threadAffinity);&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;// Initialize affinity&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;Stats [threadId].affinity = threadAffinity;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;while (1)&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;if (Lock == 0 &amp;amp;&amp;amp; InterlockedExchange (&amp;amp;Lock, 1) == 0)&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;// Increment number of times we acquired lock&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;Stats [threadId].locked ++;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;Lock = 0;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;else&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;{ &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;Stats [threadId].spinned++;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;// Be HT friendly&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;SmtPause ();&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;continue;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;return;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;//-----------------------------------------------------------------------------&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Function:main&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Description:&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Creates lock and scan threads, reporting stats every 10sec&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;// Notes:&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;//&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;int __cdecl &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;main (&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;int argc, &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;char* argv [])&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LONG_PTR&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;threadId = 0; &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;ThreadInfo&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;threadInfo [LAST_THREAD];&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;DWORD_PTR&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;processAffinity; &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;DWORD_PTR&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;threadAffinity; &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;DWORD_PTR&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;systemAffinity;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;int&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;counter = 0;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;int&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;numberOfThreads = 0;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;// Retrive process affinity&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;if (GetProcessAffinityMask (GetCurrentProcess (),&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;&amp;amp;processAffinity,&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;&amp;amp;systemAffinity) == FALSE)&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf ("GetProcessAffinityMask failed - exiting\n");&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;exit (-1);&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;// Initialize threads Information: First default and then check &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;// if client passed anything in&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;// Allocate all but one CPUs for threads running locking code&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;threadInfo [LOCK_THREAD].func = lockThread;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;threadInfo [LOCK_THREAD].affinity = processAffinity &amp;amp; processAffinity-1;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;// Allocate one CPU for scan thread&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;threadInfo [SCAN_THREAD].func = scanThread;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;threadInfo [SCAN_THREAD].affinity =threadInfo [LOCK_THREAD].affinity ^ processAffinity;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;// Read command line arguments: in simple way&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;for (counter = 0 ; counter&amp;lt; argc; counter++) &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;switch (*(argv [counter] + 1))&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;case 's':&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;case 'S':&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;// Retrieve affinity mask for scan threads&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;threadInfo [SCAN_THREAD].affinity = &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 6"&gt;(DWORD_PTR) _atoi64 ((argv [counter] + 2));&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;break;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;case 'l':&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;case 'L':&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;// Retrieve affinity mask for lock threads&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;threadInfo [LOCK_THREAD].affinity =&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 6"&gt;(DWORD_PTR) _atoi64 ((argv [counter] + 2));&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;break;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;case '?':&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;printf ("Usage: test -sn -lm \n"&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 6"&gt;"Example: test.exe -s8 -l7 (runs 1 scanning thread and 3 locking threads)\n"&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 6"&gt;"-sn is affinity of threads performing memory scan \n"&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 6"&gt;"-sm is affinity of threads acquiring lock");&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;exit (0);&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;default:&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;break;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;// Start threads of all types based on supplied affinities&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;for (counter = 0; counter &amp;lt; LAST_THREAD; counter++)&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;while (threadInfo [counter].affinity != 0)&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;// Separate affiinity for a thread we are trying to &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;// create from all affinity mask&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: Verdana; mso-outline-level: 4"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;// Remember full mask&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;threadAffinity = threadInfo [counter].affinity;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: Verdana; mso-outline-level: 4"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;// Turn off least significant bit&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;threadInfo [counter].affinity &amp;amp;= threadInfo [counter].affinity -1;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: Verdana; mso-outline-level: 4"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;// Calculate the affinity bit for the thread: &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;// Leave one bit on - affinity bit&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;threadAffinity ^= threadInfo [counter].affinity; &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: Verdana; mso-outline-level: 4"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;// Use beginthread for simplicity&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;if (_beginthread (threadInfo [counter].func, &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;NULL, &lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;(void*) threadAffinity) == -1)&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;printf ("Failed to create thread - exiting\n");&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;exit (-1);&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;numberOfThreads++;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;// Loop and report stats periodically&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;while (1)&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;// Report every 10 sec&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;Sleep (10000);&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: Verdana; mso-outline-level: 3"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;for (threadId=0; threadId &amp;lt; numberOfThreads; threadId++)&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;{&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;printf ("Thread Id = %d\t, Thread Affinity = %p\t, Locked = %d\t, Spin = %d\t\n ",&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;threadId,&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;Stats [threadId].affinity,&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;Stats [threadId].locked,&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: 'Courier New'; mso-outline-level: 5"&gt;Stats [threadId].spinned);&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: Verdana; mso-outline-level: 5"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;// Reset run time data&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;//&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;Stats [threadId].locked = 0;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 4"&gt;Stats [threadId].spinned =0;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 2in; FONT-FAMILY: Verdana; mso-outline-level: 5"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: 'Courier New'; mso-outline-level: 3"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: 'Courier New'; mso-outline-level: 2"&gt;return 0;&lt;/P&gt;
&lt;P style="FONT-SIZE: 8pt; MARGIN: 0in; FONT-FAMILY: 'Courier New'; mso-outline-level: 1"&gt;}&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;As you can see one can specify an affinity for scan and lock threads at start up of the program.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;I ran sever experiments on my dev box which has 2 physical and 4 logical CPUs. CPU 1 (Affinity 0x1) &amp;amp; 3 (Affinity 0x4)&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;and 2 (Affinity 0x2) &amp;amp; 4 (Affinity 0x8) share physical CPUs respectively. The box also has Windows 2003 Server SP1 on it.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Below are the results:&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;test.exe -s8 -l7 &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 0&amp;nbsp; , Thread Affinity = &lt;SPAN style="FONT-WEIGHT: bold"&gt;00000008&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 0&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 9035&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 1&amp;nbsp; , Thread Affinity = 00000001&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 9290331&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 10373717&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 2&amp;nbsp; , Thread Affinity = &lt;SPAN style="FONT-WEIGHT: bold"&gt;00000002&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 676397&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 40879794&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 3&amp;nbsp; , Thread Affinity = 00000004&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 10274030&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 42433521&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;test.exe -s4 -l11 &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 0&amp;nbsp; , Thread Affinity = &lt;SPAN style="FONT-WEIGHT: bold"&gt;00000004&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 0&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 8943&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 1&amp;nbsp; , Thread Affinity = &lt;SPAN style="FONT-WEIGHT: bold"&gt;00000001&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 741166&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 11421139&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 2&amp;nbsp; , Thread Affinity = 00000002&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 10747824&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 10024252&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 3&amp;nbsp; , Thread Affinity = 00000008&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 10210221&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 13988134&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;test.exe -s1 -l14 &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 0&amp;nbsp; , Thread Affinity = &lt;SPAN style="FONT-WEIGHT: bold"&gt;00000001&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 0&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 8472&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 1&amp;nbsp; , Thread Affinity = 00000002&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 10550011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 20156206&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 2&amp;nbsp; , Thread Affinity = &lt;SPAN style="FONT-WEIGHT: bold"&gt;00000004&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 722554&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 11211074&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 3&amp;nbsp; , Thread Affinity = 00000008&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 11182506&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 25376166&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;test.exe -s2 -l13 &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 0&amp;nbsp; , Thread Affinity = &lt;SPAN style="FONT-WEIGHT: bold"&gt;00000002&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 0&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 8585&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 1&amp;nbsp; , Thread Affinity = 00000001&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 9900899&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 12267885&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 2&amp;nbsp; , Thread Affinity = 00000004&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 8984095&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 11909080&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Arial; mso-outline-level: 1"&gt;Thread Id = 3&amp;nbsp; , Thread Affinity = &lt;SPAN style="FONT-WEIGHT: bold"&gt;00000008&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Locked = 1297138&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Spin = 28199769&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;Great! The experiment confirms the theory. So does it mean you have to disable HT when using SQL Server? The answer is it really depends on the load and hardware you are using.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;You have to test your application with HT on and off under heavy loads to understand HT's implications. &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;Keep in mind that not only lazywriter thread can cause slowdown but any thread that performs large memory scan - for example a worker thread that scans large amount of data might be a culprit as well. &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;For some customer applications when disabling HT we saw 10% increase in performance. So make sure that you do your home work before you decide to hyper on not to hyper :-)&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;Hope this information was useful. Let me know if you have any questions!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=492119" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/slavao/archive/tags/Coding+_2600_+Debugging+tips/default.aspx">Coding &amp; Debugging tips</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Scheduling/default.aspx">SQL Server Scheduling</category><category domain="http://blogs.msdn.com/slavao/archive/tags/Be+Aware/default.aspx">Be Aware</category></item><item><title>Configuring SQL Server 2005 for Soft NUMA</title><link>http://blogs.msdn.com/slavao/archive/2005/08/18/453354.aspx</link><pubDate>Fri, 19 Aug 2005 02:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:453354</guid><dc:creator>slavao</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/slavao/comments/453354.aspx</comments><wfw:commentRss>http://blogs.msdn.com/slavao/commentrss.aspx?PostID=453354</wfw:commentRss><wfw:comment>http://blogs.msdn.com/slavao/rsscomments.aspx?PostID=453354</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;Sometimes I am surprised how issues come up the moment you mention them &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: Wingdings; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-char-type: symbol; mso-symbol-font-family: Wingdings; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;SPAN style="mso-char-type: symbol; mso-symbol-font-family: Wingdings"&gt;J&lt;/SPAN&gt;&lt;/SPAN&gt;. Recently, I have discussed Soft NUMA configurations in the article &lt;a href="http://blogs.msdn.com/slavao/articles/441058.aspx"&gt;http://blogs.msdn.com/slavao/articles/441058.aspx&lt;/A&gt;. This week one of our customers had an interesting problem. The customer wanted to partition single SQL server instance based on the load. Customer’s application is heterogynous. It consists of TPCH type queries and data loading applications. The customer has a system, which is NUMA, with 2 nodes and 4 CPU per Node. The customer wanted to give the loading application two CPUs and the rest of CPUs to the queries. Is it possible to achieve it?&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;As you might guess the answer is&amp;nbsp;SQL2005's Soft NUMA support. We advised them to configure SQL Server and clients to treat system as three node NUMA system. (Surprised? Yes it is possible with SQL 2005 Soft NUMA support). The configuration looks like following: zero node has 4 CPUs, first node has 2 CPUs and last node has 2 CPUs. Keep in mind, when you configure SQL Server for Soft NUMA, soft nodes should fully be contained in the real nodes, i.e. a soft node can not span several real NUMA nodes. Customer’s TPCH queries were configured to utilize zero and first nodes and the load application was configured to utilize last node. Once configured and started this configuration worked as expected – load was fully partitioned across CPUs. It is important to notice that the customer was very delighted with the experience. Below is the example of node &amp;amp; network configuration we provided customer with:&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;A. Node configuration – provides node and their affinity information.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\NodeConfiguration\Node0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;"CPUMask"=dword:0000000F&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\NodeConfiguration\Node1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;"CPUMask"=dword:00000030&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\NodeConfiguration\Node2]&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;"CPUMask"=dword:000000C0&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;- Keep in mind affinity mask for a soft node can’t span multiple hardware nodes. For example 000000CF is incorrect mask. &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;B. Network Configuration – provides port &amp;amp; node assignment. &lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp\IPAll]&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;"TcpPort"="1433[0x3],2000[0x4]"&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;"TcpDynamicPorts"=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;"DisplayName"="Any IP Address"&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;- This configuration makes SQL Server to listen on two ports. One port serves two nodes. It means that port node relations ship could be one two many. &lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;- Keep in mind that in the square brackets you specify node affinity not the CPU affinity, i.e. 3 in this case means that port 1433 will processes requests on node 0 and 1 &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;- When port is assigned to multiple nodes it will assign connections to the nodes in a round robin fashion &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Once registry is configured server have to be restarted for changes to take affect. In addition clients should be configured to connect to specific ports. In the case of our customer TPCH clients were directed to port 1433 and the loading application was assigned to port 2000. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;SQL Server 2005 supports more complex configuration for Soft NUMA. Below is information along with an example provided to me by our performance team; describing how to configure SQL Server 2005 for Soft NUMA in general. Please notice that you can actually bind a specific NIC to the node. &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;This is default key where you need to change the value of TcpPort.&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp\IPAll]&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"TcpPort"=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"TcpDynamicPorts"=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"DisplayName"="Any IP Address"&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;Thus if you need 3 ports (2000,2001,1433) on a four node machine such that 2000 controls connections such that they go nodes 0 and 1 ,2001 &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;causes them to go to nodes 2 and 3 and 1433 to go to all nodes You use:&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp\IPAll]&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"TcpPort"="2000[0x3],2001[0xc],1433"&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;Thus the values in the square brackets are node masks and NOT processor masks. The above key makes all NICs on the system listen to all the above ports. Now instead, &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;if we want to control things on a NIC by NIC basis, &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;we need to flip this switch &lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;From&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp]&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"ListenOnAllIPs"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;To&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp]&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"ListenOnAllIPs"=dword:00000000&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;And then if we had Two NICs on the system besides the loopback adaptor. Note the Last part of the key “IP3” depend on the NIC number&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp\IP2]&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"Enabled"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"Active"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"TcpPort"="2000[0x3],1433"&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"TcpDynamicPorts"=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"DisplayName"="Specific IP Address"&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"IpAddress"="10.192.168.01"&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp\IP3]&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"Enabled"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"Active"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"TcpPort"="2001[0xc],1433"&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"TcpDynamicPorts"=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"DisplayName"="Specific IP Address"&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;"IpAddress"="10.192.168.02"&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;This means we shall listen to 2000 only 10.192.168.01 and pass connections received from 2000 only to nodes 0 and 1.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;And similarly for 2001.&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Below configuration which makes an 8 proc 2 node system behave as an 8 node system. It assumes that there are 8 NICs in the system&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Enabled"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"ListenOnAllIPs"=dword:00000000&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp\IPAll]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpPort"=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpDynamicPorts"="2001[0x1],2002[0x2],2003[0x4],2004[0x8],2005[0x10],2006[0x20],2007[0x40],2008[0x80]"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"DisplayName"="Any IP Address"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp\IP3]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Enabled"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Active"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpPort"="2001[0x1]"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpDynamicPorts"=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"DisplayName"="Specific IP Address"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"IpAddress"="10.192.168.01"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp\IP4]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Enabled"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Active"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpPort"="2002[0x2]"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpDynamicPorts"=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"DisplayName"="Specific IP Address"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"IpAddress"="10.192.168.02"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp\IP5]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Enabled"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Active"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpPort"="2003[0x4]"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpDynamicPorts"=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"DisplayName"="Specific IP Address"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"IpAddress"="10.192.168.03"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp\IP6]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Enabled"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Active"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpPort"="2004[0x8]"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpDynamicPorts"=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"DisplayName"="Specific IP Address"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"IpAddress"="10.192.168.04"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp\IP7]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Enabled"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Active"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpPort"="2005[0x10]"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpDynamicPorts"=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"DisplayName"="Specific IP Address"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"IpAddress"="10.192.168.05"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp\IP8]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Enabled"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Active"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpPort"="2006[0x20]"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpDynamicPorts"=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"DisplayName"="Specific IP Address"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"IpAddress"="10.192.168.06"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp\IP9]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Enabled"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Active"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpPort"="2007[0x40]"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpDynamicPorts"=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"DisplayName"="Specific IP Address"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"IpAddress"="10.192.168.07"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\Tcp\IP10]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Enabled"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"Active"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpPort"="2008[0x80]"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"TcpDynamicPorts"=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"DisplayName"="Specific IP Address"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"IpAddress"="10.192.168.08"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\NodeConfiguration] &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\NodeConfiguration\Node0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"CPUMask"=dword:00000001&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\NodeConfiguration\Node1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"CPUMask"=dword:00000002&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\NodeConfiguration\Node2]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"CPUMask"=dword:00000004&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\NodeConfiguration\Node3]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"CPUMask"=dword:00000008&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\NodeConfiguration\Node4]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"CPUMask"=dword:00000010&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\NodeConfiguration\Node5]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"CPUMask"=dword:00000020&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\NodeConfiguration\Node6]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"CPUMask"=dword:00000040&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\NodeConfiguration\Node7]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;"CPUMask"=dword:00000080&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=453354" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Memory+Management/default.aspx">SQL Server Memory Management</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Scheduling/default.aspx">SQL Server Scheduling</category></item><item><title>SQL Server 2005 NUMA support &amp; troubleshooting</title><link>http://blogs.msdn.com/slavao/archive/2005/08/02/446648.aspx</link><pubDate>Tue, 02 Aug 2005 18:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:446648</guid><dc:creator>slavao</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/slavao/comments/446648.aspx</comments><wfw:commentRss>http://blogs.msdn.com/slavao/commentrss.aspx?PostID=446648</wfw:commentRss><wfw:comment>http://blogs.msdn.com/slavao/rsscomments.aspx?PostID=446648</wfw:comment><description>&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;SQL Server 2005 has been designed to take advantage of NUMA features exposed by both hardware and the Windows operating system. There are several caveats that you need to be aware when attempting to run SQL Server on NUMA platforms.&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;In this post I would like to go over both Windows's and SQL Server's NUMA support, describe their possible configuration, and give some advises on troubleshooting some of the issues. &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;The latest SQL Server's CTP release has most of the NUMA support already built in so that you can play with it and see for yourself actual NUMA in action.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you are more interested in troubleshooting without understanding the actual issues you could jump to troubleshooting section right a way. &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;Background: I expect you understand classic cc-NUMA&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;configuration so that I don't have to go into details of explaining them. &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; MARGIN: 0in; FONT-STYLE: italic; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;Windows NUMA Support&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;NUMA hardware platforms could be configured differently. The two major configurations are pure NUMA or Interleaved NUMA. Pure NUMA will appear to operating system as a set of CPU nodes, sometimes called pods, with local memory. Depending on a hardware manufacture there will be a different penalty to access memory residing on other nodes - remote memory. In this configuration for an application to perform well it needs to minimize a number of remote accesses. &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;When system is configured to use interleaved memory, to operating system it appears as a large SMP box where memory for cache lines is&amp;nbsp;interleaved from different NUMA's nodes.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This configuration is suitable for applications that don't have NUMA optimizations and might behave badly in pure NUMA configuration. For example if you don't have SQL2000 post SP3 QFE that has NUMA optimizations you shouldn't be running SQL Server on the pure NUMA configuration. In general SQL2000 doesn't have many NUMA optimization so that you might want always to configure system as interleaved.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;When Windows starts up on pure NUMA hardware it recognizes system multi node configuration and boots accordingly. From our experience we have noticed that during the start OS will allocate memory mostly from a single node - keep in mind that this does depend on memory availability on the nodes as well as a number of applications OS has to start.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This allocation pattern during OS startup could be problematic for a NUMA aware application - since memory is not distributed evenly across the nodes and there is no way to find out memory distributions across the nodes. As a system continue running the problem becomes more severe - there is less and less free memory available on the nodes. It could be due to memory hungry applications or to System File Cache, SFC. Depending on the system configuration it is possible for System File Cache to allocate significant amount of memory. Moreover on NUMA configurations it is quite possible for SFC to unevenly use memory across nodes. If a NUMA aware application only attempts to allocate local memory it might become a victim of memory starvation on the nodes in which it collided with SFC or with other memory hungry applications. &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;Windows exposes a set of APIs that allows applications to take advantage of NUMA: &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;GetNumaHighestNodeNumber&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;GetNumaProcessorNode &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;GetNumaNodeProcessorMask &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;GetNumaAvailableMemoryNode &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;There are several API's "gotchas" that you have to be aware of:&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 0.5in; DIRECTION: ltr; unicode-bidi: embed" type=A&gt;
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=1&gt;There is no explicit way to allocate memory from the given node - a- thread allocates a memory from a given memory node by changing its affinity to the given node and then calling VirtualAlloc (if running with swap file you will have to touch virtual address before it gets bound to physical page) or other low level APIs that will trigger physical page allocation. If OS doesn't have memory on a given node it will serve the memory from the different node. It won't fail the allocation.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=2&gt;GetNumaAvailableMemoryNode could return 0 even though there could be a still memory that OS could serve from the node. 
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=3&gt;Windows will serve memory in the following order: 1. From the node a thread is affinitized to 2. From node that has memory free and 3. From any node - memory freed up from standby lists, working sets and System File Cache. &lt;/LI&gt;&lt;/OL&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;The consequences of A &amp;amp; C is that NUMA aware applications should have more of special handling for remote memory. A &amp;amp; C might cause OS to return memory in random order such as remote, local, remote, and etc.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Keep in mind if applications decides not to cache remote memory it might get in trouble because when memory is freed it gets put on the free list and will be given away on the next allocation request.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;The consequences of B is that applications can't reliably decide whether they can or can't allocate memory from the node. Case B usually occurs after system runs for some time especially when large applications are present. &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; MARGIN: 0in; FONT-STYLE: italic; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;SQL Server 2005 NUMA Support&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;SQL Server 2005 attempts to take full advantage of NUMA architecture by leveraging SQLOS for more info see &lt;a href="http://blogs.msdn.com/slavao/articles/441058.aspx"&gt;http://blogs.msdn.com/slavao/articles/441058.aspx&lt;/A&gt;. During startup SQL Server will configure itself&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;base on underlying OS and hardware configuration.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It will create the environment inside of itself&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;to mimic the actual hardware - SQL Server will create a software abstraction, for purpose of our discussion we will call it a Node, around every NUMA node and its memory.&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;Every SQL Server's&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Node has a memory manager, set of schedulers each of which maps to a underlying CPU; I/O port and other components.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;SQL Server's Node could be considered as a separate SQL Server instance with its own I/O port that it listens on. Clients or separate applications can be configured to connect to a specific Node only.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;A Node can be online - accepting new work or offline, accepting neither new work or connections.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;State of a Node could be changed on the fly using affinity settings - see setting affinity below.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;A connection could be made to a given Node or set of Nodes - a network port could be associated with multiple Nodes. If no extra configuration specified a new connection is assigned to a next Node in a round robin fashion. If connection is made to a set of Nodes it will be assigned to a next Node in a round robin fashion across that set of Nodes. BOL has plenty of information on how to configure SQL Server's ports, nodes and clients to connect. Once connection is created it is bound to a Node until disconnected.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If connection's Node is moved offline its work will be scheduled on other Nodes. All the memory that is required to serve the connection's needs is allocated locally from the memory that is attached to the Node.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Database pages are always allocated locally from the Node's memory they accessed on unless they have been brought into the memory by connection assigned to another Node. Please keep in mind that in the latest CTP SQL Server attempts not to allocate memory from different Node. This behavior might cause premature OOM or significant query slow down.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;To support different NUMA features SQL Server can be configured both on server and client site. On the server site DBAs can configure amount of memory, active Nodes, a number of threads, locked pages, network configuration - what NIC is bound to what Node. On the client side DBA can configure particular clients/applications to connect to specific Nodes. &lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;Below are two settings that affect SQL Server behavior on NUMA&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 0.5in; DIRECTION: ltr; unicode-bidi: embed" type=A&gt;
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=1&gt;Affinity - Using sp_configure a DBA can easily change SQL Server affinity. The major difference between SQL Server 2000 and SQL Server 2005 is that affinity changes will take affect right away - no server restart is required.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;As you know from SQL 2000 if affinity is not set SQL Server will affinitize itself to all CPUs. In SQL Server 2005 when running on NUMA and affinity is not set SQL Server will affinitize each scheduler to a set of CPUs that a SQL Server Node maps to. For example for a NUMA node 1 (nodes are numbered starting with 0) with 4 CPUs, SQL Server's schedulers belonging to Node 1 will have affinity of 0xF0. When DBA does specify affinity, we call it hard affinity, every scheduler in a Node will be affinitized to its own CPU. For example in the above example first scheduler will have affinity 0x10. When a Node's scheduler maps to an underlying CPU we say that scheduler is online. It is possible for a scheduler to be offline. For example lets say on two NUMA node system, DBA sets server affinity to be 0x1F - only 5 schedulers a mapped to actual CPUs; 4 from the Node 0 and 1 from the Node 1.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Last 3 schedulers from the Node 1 are moved offline - no new work will be submitted to them. If all schedulers from a given Node are offline then the whole Node is offline - it won't get any of work assigned moreover no new connections will be made to that Node. &lt;/LI&gt;&lt;/OL&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 0.5in; DIRECTION: ltr; unicode-bidi: embed" type=A&gt;
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=2&gt;Max Server Memory - These are the global settings. In the current CTP SQL Server 2005 will continue allocate memory from a given node until either node still has memory - allocation returns a memory from requested node or overall allocated memory doesn't exceed max server memory.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;SQL Server won't try to allocate/use remote memory - the issue will be addressed in the final version of SQL Server 2005. &lt;/LI&gt;&lt;/OL&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; MARGIN: 0in; FONT-STYLE: italic; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;Troubleshooting problems related to SQL Server running on NUMA&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&lt;SPAN style="FONT-STYLE: italic"&gt;A query runs sporadically slow even if plan doesn't change or clients observes other significant perf degradations - &lt;/SPAN&gt;is the most common problem. The major cause of the problem is memory exhaustion on the Node query is running on. The memory exhaustion could happen due to multiple reasons:&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 0.5in; DIRECTION: ltr; unicode-bidi: embed" type=A&gt;
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=1&gt;Node 0&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;problem - All memory on this node is consumed during OS startup.&lt;/LI&gt;&lt;/OL&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;Possible solution for this problem is to change SQL Server affinity to move Node 0 offline.&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 0.5in; DIRECTION: ltr; unicode-bidi: embed" type=A&gt;
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=2&gt;Node n problem - All memory on this node is consumed by other applications or by System File Cache (also see misconfigured SFC problem below).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You can verify if you are hitting this problem by looking at the size of SFC, other applications' memory consumption and amount of memory consumed by SQL Server on every Node from dbcc memorystatus.&lt;/LI&gt;&lt;/OL&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;Possible solution for this problem is to grab all the memory for SQL Server before starting other applications. You can achieve it by utilizing max server memory, dynamic scheduling and clients affinity.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The idea is to start one Node at a time, connect to the node, apply load to allocate memory on the Node, start next Node, apply load, force memory allocation and so on. At the end set min and max memory to be the same so that SQL Server doesn't shrink its memory usage under the load. Here are the steps you need to make to achieve it:&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 0.5in; DIRECTION: ltr; unicode-bidi: embed" type=1&gt;
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=1&gt;Configure SQL Server to run on multiple Nodes with a port per Node 
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=2&gt;Configure a client for each Node 
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=3&gt;Prepare large query, for example reindex, that will require at least DesirableMemory/#Nodes of memory 
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=4&gt;Start SQL Server 
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=5&gt;Move all Nodes offline except for Node 0 using sp_configure 
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=6&gt;Set "max server memory" to DesirableMemory/#Nodes using sp_configure 
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=7&gt;Connect to Node 0 
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=8&gt;Run the job 
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=9&gt;Increase "max server memory to "max server memory" + DesirableMaxMemory/#Nodes using sp_configure 
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=10&gt;Move next Node online using sp_configure 
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=11&gt;Repeat 7-10 for the rest of the Nodes 
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=12&gt;Set "max server memory" = "min server memory" = DesirableMaxMemory&lt;/LI&gt;&lt;/OL&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 0.5in; DIRECTION: ltr; unicode-bidi: embed" type=A&gt;
&lt;LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=3&gt;Misconfigured System File Cache problem - This problem is related to Node n problem. If FSC is incorrectly configured it can consume all the memory on the machine. You can verify if you are hitting this issue by looking at the size of FSC through either TaskManager or perfmon.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You can fix the issue by going to "My Computer"-&amp;gt;"Properties"-&amp;gt;"Advanced"-&amp;gt;"Performance Settings"-&amp;gt; "Advanced"-&amp;gt;"Memory Usage Programs"-&amp;gt;"Ok" and reboot the box, if you changed the setting.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It is possible for the applications even when configured for Programs to force large consumption in System File Cache. If it happens you could write an application that periodically trims the size of System File Cache. There is one available from SysInternals &lt;A href="http://www.sysinternals.com/Utilities/CacheSet.html"&gt;http://www.sysinternals.com/Utilities/CacheSet.html&lt;/A&gt; (I haven't tried it lately so use it at your own risk :-))&lt;/LI&gt;&lt;/OL&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;Your comments are welcome!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=446648" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Memory+Management/default.aspx">SQL Server Memory Management</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Scheduling/default.aspx">SQL Server Scheduling</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQLOS/default.aspx">SQLOS</category></item><item><title>SQLOS helps SQL Server to leverage hardware capabilities</title><link>http://blogs.msdn.com/slavao/archive/2005/07/20/441064.aspx</link><pubDate>Wed, 20 Jul 2005 21:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:441064</guid><dc:creator>slavao</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/slavao/comments/441064.aspx</comments><wfw:commentRss>http://blogs.msdn.com/slavao/commentrss.aspx?PostID=441064</wfw:commentRss><wfw:comment>http://blogs.msdn.com/slavao/rsscomments.aspx?PostID=441064</wfw:comment><description>&lt;P&gt;I just finished an article on how SQLOS helps SQL Server to leverage hardware capabilities &lt;a href="http://blogs.msdn.com/slavao/articles/441058.aspx"&gt;http://blogs.msdn.com/slavao/articles/441058.aspx&lt;/A&gt;.&amp;nbsp; &lt;FONT style="BACKGROUND-COLOR: #c0c0c0"&gt;It will be interesting to hear your comments, thoughts. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="BACKGROUND-COLOR: #c0c0c0"&gt;Thanks a lot in advance&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=441064" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Memory+Management/default.aspx">SQL Server Memory Management</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Scheduling/default.aspx">SQL Server Scheduling</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQLOS/default.aspx">SQLOS</category></item><item><title>Be aware: FLS-Fiber Local Storage</title><link>http://blogs.msdn.com/slavao/archive/2005/02/28/381649.aspx</link><pubDate>Mon, 28 Feb 2005 19:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:381649</guid><dc:creator>slavao</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/slavao/comments/381649.aspx</comments><wfw:commentRss>http://blogs.msdn.com/slavao/commentrss.aspx?PostID=381649</wfw:commentRss><wfw:comment>http://blogs.msdn.com/slavao/rsscomments.aspx?PostID=381649</wfw:comment><description>&lt;p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;Problem:&lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: Verdana; mso-outline-level: 2"&gt;In the last several months there were several publications describing usage of fibers.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;When covering SQLOS's scheduling I will go into more details about them. Today I would like to touch on the subject on how to make your dlls/libraries more robust in the fiber environment. &lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: Verdana; mso-outline-level: 2"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: Verdana; mso-outline-level: 2"&gt;As you know, when running SQL server in a fiber mode you need to be very careful when using functionality that make heavy usage of TEB, thread environment block, or TLS, thread local storage. During a fiber switch TLS and many other fields in TEB don't get switched.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: Verdana; mso-outline-level: 2"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: Verdana; mso-outline-level: 2"&gt;You will be surprised how many libraries leverage TLS and don't work correctly with Fibers. Even older versions of MSVCRT, c-runtime, leverage TLS to allocate their per thread local data. The list of broken libraries include:&lt;/p&gt; &lt;ul style="MARGIN-TOP: 0in; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 1.5in; DIRECTION: ltr; unicode-bidi: embed" type="disc"&gt; &lt;li style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; mso-outline-level: 3"&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;COM&lt;/span&gt;&lt;/li&gt; &lt;li style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; mso-outline-level: 3"&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;RPC&lt;/span&gt;&lt;/li&gt; &lt;li style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; mso-outline-level: 3"&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;Side by Side&lt;/span&gt;&lt;/li&gt; &lt;li style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; mso-outline-level: 3"&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;Older versions of CRT&lt;/span&gt;&lt;/li&gt; &lt;li style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; mso-outline-level: 3"&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;Windows synchronization: Critical Section &amp;amp; Mutex&lt;/span&gt;&lt;/li&gt; &lt;li style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; mso-outline-level: 3"&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;...&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 1in; FONT-FAMILY: Verdana; mso-outline-level: 3"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: Verdana; mso-outline-level: 2"&gt;So how do you protect yourself? Starting with Windows XP/2003, operating system introduced FLS, Fiber local storage: &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/flssetvalue.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/flssetvalue.asp&lt;/a&gt;. It has exactly the same semantics as TLS. However, opposite from TLS, FLS is per a fiber and it does get switched during SwitchToFiber call.&lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: Verdana; mso-outline-level: 2"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: Verdana; mso-outline-level: 2"&gt;This means that if your dll will be used in fiber mode, you might want to consider using FLS instead of TLS. If a thread is not converted to a fiber, FLS is still available and there is no much overhead in using it.&lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: Verdana; mso-outline-level: 2"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: Verdana; mso-outline-level: 2"&gt;If you are running XP, extended stored procedure or dll that will be loaded into SQL Server, you must use FLS. Be careful though FLS is not available on Win2K. Applications that need to run on down level platforms have to use dynamic linking - leveraging GetProcAddress API to make sure that your dll loads correctly there. &lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;A bit of history:&lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: Verdana; mso-outline-level: 2"&gt;FLS was finally introduced in Windows XP and 2003 because latter version of c-runtime made heavy usage of TLS for exception handling. This turned fiber mode completely unusable. &lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: Verdana; mso-outline-level: 2"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;How it works:&lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 0.5in; FONT-FAMILY: Verdana; mso-outline-level: 2"&gt;When a thread is created it doesn't have FLS set up. Windows uses lazy initialization for FLS. When FLSAlloc gets called for the first time, OS allocates FLS for this thread. Once thread is converted to fiber, FLS gets switched during SwitchToFiber call.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;You can use FLSCallBack to destroy FLS entries when a fiber/thread exists or FLS gets shrunk. &lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: Verdana; mso-outline-level: 1"&gt;I will be glad to hear your comments!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=381649" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Scheduling/default.aspx">SQL Server Scheduling</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQLOS/default.aspx">SQLOS</category><category domain="http://blogs.msdn.com/slavao/archive/tags/Be+Aware/default.aspx">Be Aware</category></item><item><title>SQLOS - unleashed</title><link>http://blogs.msdn.com/slavao/archive/2005/02/05/367816.aspx</link><pubDate>Sun, 06 Feb 2005 00:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:367816</guid><dc:creator>slavao</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/slavao/comments/367816.aspx</comments><wfw:commentRss>http://blogs.msdn.com/slavao/commentrss.aspx?PostID=367816</wfw:commentRss><wfw:comment>http://blogs.msdn.com/slavao/rsscomments.aspx?PostID=367816</wfw:comment><description>&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;With SQL Server 2005 Beta 1 and Beta 2 you might have noticed that there is no ums.dll in the bin directory. The reason is simple it is no longer exists.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;In SQL2000 ums.dll provided SQL Server with user mode non-preemptive scheduling. So what happened in latest version? Have we removed non-preemptive scheduling? The answer is no. &lt;?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /&gt;&lt;st1:place w:st="on"&gt;&lt;st1:State w:st="on"&gt;Yukon&lt;/st1:State&gt;&lt;/st1:place&gt; continues relying on non-preemptive scheduling. As adequate research shows for RDBMS engine to meet performance and scalability requirements it needs to leverage non-preemptive scheduling. &lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;In &lt;st1:State w:st="on"&gt;&lt;st1:place w:st="on"&gt;Yukon&lt;/st1:place&gt;&lt;/st1:State&gt; we took idea of non-preemptive scheduling further and have created new component, library, SQLOS, or sometimes referred as SOS. SQLOS is a user mode operating system. It includes OS pieces such as non preemptive scheduling, memory management, resource monitoring, exception handling, I/O, synchronization and hosting subsystems. Keep in mind SQLOS doesn’t provide OS abstraction layer to SQL Server. It doesn’t warp any of Windows APIs for portability purposes. Contrary it continues further binding of SQL Server to Windows by exploiting scalability and performance features of the Operating System.&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;The goals of SQLOS include bringing all system components together, enabling further innovation of SQL Server’s scalability and performance, providing manageability and supportability features. It exposes cohesive API to developers so that they can easily exploit features of hardware and the operating system. &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;SQLOS models its internals to simplify developing process as for high and as for low end platforms. &lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;SOS’s scheduling subsystem consists of scheduling nodes, schedulers, tasks, workers and system threads. A scheduling node provides an abstraction layer over group of CPUs. On NUMA systems scheduling node represents a single NUMA node. On SMP box there is one scheduling node. It is possible to change a number of nodes&amp;nbsp;by editing Windows&amp;nbsp;registry. We call such configuration soft NUMA. &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;As you would expect a node also is a collection of schedulers. A scheduler is&amp;nbsp; anabstraction over a CPU. Schedulers deal with tasks that run by workers that get executed by system threads.&amp;nbsp; Description of SQLOS scheduling could take pages and pages so I will cover&amp;nbsp;it in depth&amp;nbsp;in separate post. &lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;SQLOS’s memory management consists of memory nodes, memory clerks, caches, pools, and memory objects. A memory node is an abstraction over the memory attached to a scheduling node. A scheduling node is a proper subset of memory node. Separating scheduling and memory nodes enables us to model different hardware configurations. Every component leverages its own memory clerk to allocate large blocks of memory. Memory objects, heaps, utilize memory clerks to allocate memory. When SQL Server runs it creates&amp;nbsp;a number of different&amp;nbsp;memory clerks and memory objects. &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;One could monitor them by quering&amp;nbsp;SQL Server's&amp;nbsp;DMVs, Dynamic Management Views. &lt;/span&gt;In addition to nodes, clerks and memory objects, SQLOS implements unique caching and pooling frameworks. The whole memory subsystem deserves several &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;posts and as promised I will start covering it pretty soon. &lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;SQLOS contains several threads to provide self monitoring and adequate resource distribution. In addition SOS exposes hosting interfaces. Hosting API significantly simplifies integration of CLR and SQL Server engines. CLR leverages SQLOS’s hosting API for all of its OS needs including thread pooling and memory management. &lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&amp;nbsp;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;There is plenty of information to cover about SQLOS. One probably could write&amp;nbsp;a whole book describing it. In my next post I will start going over SQLOS memory manager in deeper details. &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;If you haven’t read my previous posts about Windows memory management it is time to do so.&amp;nbsp;You&amp;nbsp;need to be&amp;nbsp;ready so that you can fully enjoy the next article. &lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;Please feel free to ask any questions. And let me know your comments. &lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;Enjoy great weekend!&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=367816" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Memory+Management/default.aspx">SQL Server Memory Management</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQL+Server+Scheduling/default.aspx">SQL Server Scheduling</category><category domain="http://blogs.msdn.com/slavao/archive/tags/SQLOS/default.aspx">SQLOS</category></item></channel></rss>