Can the Linux function msgget (), msgsnd () and msgrcv () be called by multiple threads in the same process?
You do not need to worry about the racing conditions, the system will take care of it, with these challenges there will be no race condition.
Can the semop () function be used to synchronize threads in a single process?
Yes, read more in the documentation.
Should I use a level semaphore between processes and a thread level semaphore?
Any resource that is globally distributed between threads or processes depends on race conditions due to one or more threads or processes trying to access it at the same time. Therefore, you need to synchronize access to such a global global resource.
source share