3 ms·
collaborate with other experienced dev folks. You learn a lot from reading people's code in a professional environment. Or, use high level libraries. If you sti
by bsvalley 9y ago
collaborate with other experienced dev folks. You learn a lot from reading people's code in a professional environment. Or, use high level libraries. If you still manipulate semaphores in 2017, you are wasting a lot of time since there are a couple of high level libraries out there that do the job for you. They're maintained by the open source community, etc.
Part of being a good programmer involves trusting other developers. Sharing code, reusing code, etc. That's how our community works and trying to use basic principles in your code isn't always the way to go. To manage concurrent code today it's better to use a Queue for instance. Setup your queue and just push task into it. Synchronously or asynchronously, you get to pick what ever you want. It usually comes with a bunch of other features, like maintaining a certain order when asynchronous tasks get executed. In most of the modern languages, they offer thread safe and none thread safe data structures. Pick the one you need. And that's just one example.
- yurish 9y agoI have no problem with reusing existing libraries, queues whatever. But sometimes you have to work with lower level stuff. Even in 2017. So the question is less about general recommendations and more about specific methods that can help in designing and analysing concurrent code. Sorry if I did not make it clear.