Tagged in

Threading

theburningmonk.com
theburningmonk.com
the personal blog for Yan Cui
More information
Followers
926
Elsewhere
More, on Medium

Be Lazy, but be ware of initialization exception

.Net 4 introduced the Lazy<T> type which allows you to create an object that can be lazily initialized so that you can delay the creation of large objects, for instance.


Takeaways from Gael Fraiteur’s multithreading talk

After watching Gael’s recent SkillsMatter talk on multithreading I’ve put together some notes from a very educational talk:

Hardware Cache Hierarchy


SmartThreadPool — What happens when you take on more than you can chew

I’ve covered the topic of using SmartThreadPool and the framework thread pool in more details here and here, this post will instead focus on a more specific scenario where the rate of new work items being…


Threading — thread-safe size capped queue

Here is a queue class based on the implementation Marc Gravell provided in this StackOverflow question:

[code lang=”csharp”]
/// <summary>
/// A thread-safe fixed sized queue implementation
/// See…


Threading — introducing SmartThreadPool

As I’ve mentioned in my previous post, the biggest problem with using the .Net ThreadPool is that there’s a limited number of threads in the pool and you’ll be sharing with other .Net framework classes so you need to be on your best behaviour and not hog the…


Threading — using the ThreadPool vs. creating your own threads

There are a lot of discussions on the pros and cons of using the ThreadPool and creating your own threads. Having spent a bit of time reading what others have to say, here’s a summary of the things I’ve picked up on.


Threading — Producer-Consumer Pattern

Having run into a bit of deadlocking issue while working on Bingo.Net I spent a bit of time reading into the Producer-Consumer pattern and here’s what I learnt which I hope you’ll find useful too.

AutoResetEvent and…


Threading — when to use Monitor.Pulse and Monitor.PulseAll

Ever wondered when you should use Monitor.Pulse and when you should use Monitor.PulseAll given that only one thread will be able to acquire the lock even if you wake up multiple threads? I did, and that’s when I stumbled across a…