Holy cow, I wrote a book!
When doing high-performance computing, you need to worry
about the CPU cache line size in order to avoid issues
like false sharing.
But how can you determine the processor's cache size?
The GetLogicalProcessorInformation function
will give you characteristics of the logical processors
in use by the system.
walk the SYSTEM_LOGICAL_PROCESSOR_INFORMATION
returned by the function looking for entries of type
Each such entry contains a ProcessorMask which tells
you which processor(s) the entry applies to,
and in the
it tells you what type of cache is being described
and how big the cache line is for that cache.
Windows 7 adds the function
which does the RelationCache filtering for you.