I've been diving into the concepts of thread safety in Linux, especially in relation to POSIX standards, but I'm curious about process safety. As far as I know, thread-safe applications exist across various operating systems, but is there an equivalent term or standard for process safety? I want to understand if such a concept exists and what it entails.
2 Answers
Yeah, it's surprising that no one jumped in sooner. But just to clarify, process safety generally isn’t a standard term because processes handle resources differently than threads. If a process is accessing a resource independently, it doesn't really run into the same issues as with threads. But if you're leveraging shared resources across processes, then you might need to implement some synchronization methods to avoid race conditions.
Actually, thread safety is about code (like functions in a library) that can be used safely in concurrent threads. Applications themselves aren't really classified as thread-safe; it's the code that is. As for process safety, it's a bit of a tricky concept since processes don’t share memory like threads do. So if you think about 'process-safe' in the same way as 'thread-safe', then by that logic, most processes would be considered process-safe since they operate independently. But if you’re thinking about sharing resources, like global data, then it depends on what specifically you're sharing.
So, if processes aren't sharing memory, what about cases where they access shared resources like files or sockets? How do we ensure safety there?

Totally get that! I was thinking about how things like semaphores or message passing might come into play for managing shared resources.