Posts Tagged ‘semaphore’

Multithreaded simple data type access and atomic variables

Table of contents Introduction How atomic variables work Atomic variables size limitations Use cases The real thing… Time to see some action Precautions Conslusion IntroductionBACK TO TOC In this article I would like to continue subject I started in my previous two posts (post 1 and post2). Question I am trying to answer is what […]

pthread 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.

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 changes you’ve made to the value will remain intact. But really, can you modify variables […]