May 22, 2008
1:39 am

The second part of this series covers Data Structures and Locks. I will provide general guidance on which data structures to use under certain circumstances and how to use locks without having a negative impact on performance.  Finally, there will be examples covering common problems/solutions and a simple cookbook detailing functional requirements and recommendations when using data structures and locks.

In order to avoid cache line thrashing and a high rate of lock collisions, the following are suggested guidelines when designing an application:

· Minimize the need for a large number of locks by partitioning data amongst threads or processors.
· Be aware of the hardware cache-line size because accessing different data items that fall on the same cache-line is considered a collision by the hardware.
· Use the minimum mechanism necessary in data structures.  For example, don’t use a doubly-linked list to implement a queue unless it is necessary to remove from the middle or scan both ways.
· Don’t use a FIFO queue for a free list.
· Use lock-free techniques when possible.  For example, claim buffer space with InterlockedAdd and use an S-List for free lists or producer/consumer queues.

Full Article

Related Posts:

No comment yet

Leave a comment »

1  Trackbacks & Pingbacks: | TrackBack URI

  1. Pingback from
    1
    Designing Applications for High Performance - Part 3 » D' Technology Weblog: Technology, Blogging, Tips, Tricks, Computer, Hardware, Software, Tutorials, Internet, Web, Gadgets, Fashion, LifeStyle, Entertainment, News and more by Deepak Gupta. says:June 26th, 2008 at 12:44 am

    [...] for High Performance - Part 3 The third, and final, part of this 3 part series[Part -1, Part - 2] covers I/O Completions and Memory Management techniques.  I will go through the [...]

Leave a Response

Comment Preview
« Creating a Deep Zoom CollectionWindows Home Server Power Pack 1 Beta - Signup »
Feed Icon

Subscribe via RSS or email: