You do your stuff, I’ll contemplate…

If you read my last post, you know that I started a small project that involves some thread safe data handling. As usual I struggled with the question of implementing things by myself or not. In a productive environment, like work, I would never go that path if there’s not a really good reason for it. But why in a private project?

Konfuzius once said The Journey Is The Reward. Sounds cheesy? Yes. But it’s true and it’s, in my honest opinion, the best reason to go the long way and struggle instead of taking the short cut. In this case it’s implementing a mutable, thread safe data structure. That wheel was invented a lot of times already. But to take the time to reinvent it for yourself once more gives you a lot of experience. It helps you understand the details and all the mean little edge cases.

I hope I was able to convince you to try the long path from time to time, when you do something for yourself.

What do you think about it? Tell me in the comments!

Comments

Adding comments is only possible via Instagram directly, sorry. If you're okay with visiting Instagram, you can use the link to my post .

  1. #worldcode #workenvironment #mindsetmatters #webdeveloper #developerjobs #htmlcode #seniordeveloper #peoplewithlaptops #workhardanywhere #peoplewhocode #thedevlife #appdeveloper #buildtheweb #codergallery #weprogrammers #developerdiaries #developerlifestyle #setupgoals #myworkspace #designyourworkspace #minimalbeast #hustle #techsetup #deskgoals #informationtechnology #dellxps #linux @codeclique @comment_sense @lovecoders @coding @worldcode @coderlifes @programmerrepublic @thedevlife @peoplewhocode @developerstuff

    1. I often recommend the long road to other developers who are still learning. I’m assuming you’re implementing pthreads functions in a posix environment? A competing vision might be what Rust is doing. Implementing thread safe data structures using volatile memory instead of mutex locking, worth looking into the Arc data structure if you’re going down that rabbit hole.

      1. @coffee_n_code you can have as simple or complex of a data structure or process as you need. In C you use the locks to protect an atomic op. So you may need the lock around mutating memory, reading a buffer, or working with io.

        1. @dnsbrian be aware that cross thread synchronization comes at a heavy cost when high throughput or low latency is a expected. That’s where the thread-per-core approach is really winning.

          1. @dnsbrian absolutely. That's why one single point of truth and an Arc around it. Thanks for your input. It's really helpful!

          2. If you really want to rabbit hole some more, research coroutines.