Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Whereas you have to lock every piece of state that you have.

You need to lock every piece of shared state you have. Where "shared" means stuff that many threads must communicate among themselves. One tends to keep the number of that kind of state low, really low. When zero is not possible, the most common number by a wide margin is one¹.

If you have more than 1, they are normally completely independent pieces of state that will not be used at the same time. If you have more than 1, and they are not independent, the code is either the result of at least one PHD thesis, or it does not work (or, often, both).

I bet you do network requests more than once on your code.

1 - The size of the shared state does not matter, so it's often one really big state.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: