---
title: "Nice Threading in .NET 2.0 E-Book and online reference"
url: "https://osherove.com/blog/2006/8/19/nice-threading-in-net-20-e-book-and-online-reference.md"
canonical: "https://osherove.com/blog/2006/8/19/nice-threading-in-net-20-e-book-and-online-reference.html"
published: "2006-08-19T00:56:52"
updated: "2006-08-19T00:56:52"
tags: [".NET", ".Net 2.0"]
author: "Roy Osherove"
description: "Update : Here's a little article that shows locking with Blocking Queues (an idea I refer to at the bottom of the article) I recently found this great online E-Book about Threading in .NET (also applies to .NET 2.0!),…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Nice Threading in .NET 2.0 E-Book and online reference

By Roy Osherove August 19, 2006 In [.NET](https://osherove.com/blog/category/net), [.Net 2.0](https://osherove.com/blog/category/net-2-0)

**Historical article** · Originally published August 19, 2006; technical details may be outdated.

_**Update**: Here's a_ [_little article_](http://www.dotnetjunkies.com/Tutorial/D7E688B8-0BDD-4D44-9A0F-4CD26FB35F51.dcik) _that shows locking with Blocking Queues (an idea I refer to at the bottom of the article)_

I recently found [this great online E-Book](http://www.albahari.com/threading/) about Threading in .NET (also applies to .NET 2.0!), thanks to a link on [this blog.](http://spietrek.blogspot.com/2006/08/threading-in-c-free-e-book.html)

I've used it several times since to learn about interesting and useful stuff such as how to properly use ReaderWriterLocks, When does Thread.SpinWait() make sense (almost never) and the various ways there are to synchronize access to common resources in a multi threaded, multi CPU environment (lots).

The thing about .NET threading is that, not only is it scary to the uninitiated (as it should be), every time to check it out, you find out something you didn't know about.

One thing I got to notice a lot about threading, and locking specifically, is that people tend to use it where it's not really needed, or where other approaches tend to make more sense. For example. a case where you are trying to synchronize multiple commands from multiple threads into a single resource, that performs a "heavy" task for each request.

Many people tend to approach this with WaitHandles and what not, when easily one of the most scalable approaches is to put a Request Queue somewhere in the receiving end, and simply "pop" messages out of the queue when you are finished handling the last one. It makes the locking scheme much more easily understood, and makes for a very scalable system (you could easily have multiple threads reading from the queue to handle more requests at the same time when on a multi CPU machine, for example).

So, threading \*is\* important, especially to understand when you need to use \*other means\* to accomplish your tasks, and how threading can help to make using those other means run smoothly (in my example, synchronizing the read/write to the queue may be in order, but the queue is the "other means" by which you separate your requests into a logical "first in, first out" requirement in the system.

## More in .NET

[All posts in .NET](https://osherove.com/blog/category/net)

- Aug 27, 2006

    ### [16 Features in Resharper Every Developer Needs To Learn](https://osherove.com/blog/2006/8/27/16-features-in-resharper-every-developer-needs-to-learn.html)

- Aug 21, 2006

    ### [Free E-Book: Developing Time-Oriented Database Applications in SQL](https://osherove.com/blog/2006/8/21/free-e-book-developing-time-oriented-database-applications-i.html)

- Aug 16, 2006

    ### [SharpRobo - Winform UI Unit Testing made easier?](https://osherove.com/blog/2006/8/16/sharprobo-winform-ui-unit-testing-made-easier.html)

- Aug 6, 2006

    ### [2 Day Architecture & SOA Course - Sound Interesting?](https://osherove.com/blog/2006/8/6/2-day-architecture-amp-soa-course-sound-interesting.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
