I’ve read in this post regarding named and unnamed semaphore , which states that a named semaphore is used for 2 unrelated processes , and unnamed semaphore is used for 2 related processes .
If my program works with both related and unrelated processes , can I use a named semaphore for both cases ?
Thanks
Yes you can, a named semaphore always works.
As stated in the post you linked an unnamed semaphore is easier to handle (because the OS does take care of a lot of stuff automatically) but requires some shared structures between the involved processes.