Skip to main content

Posts

Showing posts from April, 2021

Some Mysteries of Multi-Threading

 If you have been programming professionally for some time, you probably would have used threads. When used correctly, threads can provide significant speed up in the program. I had also written multithreaded programs many times at Sumo Logic. However, recently I felt that since threading is such an important topic, I should probably dive a little deeper into how things work there. I started off by reading Java Concurrency in Practice  and although I have gone through only a couple of chapters right now, but still I have discovered some interesting things which I was not aware of before. The thing which makes multi-threading hard is that you may write a multi-threaded program which works correctly almost all the time but it may still be wrong. It may have some race condition which happens very rarely. The problem is that it might happen in production and cause an outage and you will be clueless about the issue since you have never seen it before. The only way to write correct ...