Re:Singleton Is a Bad Idea
by Matthias247 on Sunday April 10, 2022 @02:01PM
(#30979773)
When you start executing a binary, it becomes a procoess. As long as the code in the binary allows for it, there can be multiple instances of it. So a exe/binary is more along of a regular class than a singleton.
[ Parent
| on HN ]
If two process are modifying the same file.... that file is a 'single object'. So, the Parent's point stays.
A process can create its own copy, and do things with it, but eventually it has to load and save it at one single place.
That's exactly the same as a specific non-singleton object instance. Processes have handles that represent open files.
The filesystem tree on an unix OS is a better example but that was also been identified as a mistake and there have been attempts to rectify it (namespaces)