Do you need a mutex to protect an int?
Recently I ran into few pieces of code here and there that assumed that int is an atomic type. I.e. when you modify value of the variable from two or more different threads at the same time, all of the...
View Articlepthread spinlocks
Continuing my previous post, I would like to talk about relatively new feature in glibc and pthreads in particular. I am talking about spinlocks. Quiet often you want to protect some simple data...
View Articlepthread mutex vs pthread spinlock
Update 06/16/2009: On several occasions, commentators to this article pointed out that this post is somewhat incomplete. Therefore, before I continue, I would like to make some things clear. Before...
View ArticleNew article – C/C++ reference counting with atomic variables and gcc
This article explains how to implement performance critical reference counting in C/C++ program, using atomic variables and gcc. Enjoy it. Read the article here.
View ArticleModels for multithreaded applications
As you know, I changed a couple of workplaces during my career. Long story short, one interesting thing that I noticed in different companies is various models for multi-threaded programs (mostly for...
View Articletcpdump for Dummies
Table of contents Introduction What reference counting needed for? This is how we will use atomic variables to count references to objects The naive approach The RCU approach Where atomic variables...
View ArticleC/C++ reference counting with atomic variables and gcc
Table of contents Introduction What reference counting needed for? This is how we will use atomic variables to count references to objects The naive approach The RCU approach Where atomic variables...
View Article