4 ms·
The basic POSIX interface works, but it's hardly optimal. It has a lot of weird built-in assumptions that we're just so used to working around that it's hard t
by elihu 5y ago
The basic POSIX interface works, but it's hardly optimal. It has a lot of weird built-in assumptions that we're just so used to working around that it's hard to imagine it being any other way.
As an example: why can a process only have one current working directory? Wouldn't it be nice to be able to have a process maintain pointers to two or more locations in the filesystem at once? Wouldn't it make software more modular if a library could "chdir" into some directory without worrying about breaking the application that depends on it? The filesystem APIs could be extended with a "CWD" handle argument that can be passed around sort of like a file descriptor instead of having one implicit CWD for the whole process.
The same could be done with UIDs. Why not have processes that can use multiple UIDs? Again, you could have UID parameters to API functions that require authorization.
POSIX is pretty good by the standards of 80's computers, but in a lot of ways it's showing its age. We can do better. But it's kind of depressing that OS interface design is treated as a solved problem, and so those interfaces stagnate.
- Dylan16807 5y ago> The filesystem APIs could be extended with a "CWD" handle argument that can be passed around Why would you even want a working directory at that point?
- elihu 5y agoWhat's the alternative? To use absolute paths for everything? That seems kind of tedious, and may be slightly less performant if the kernel has to do more dentry lookups. I think the idea of a current working directory is a reasonable one, it's just that the limitation that a process can only have one CWD at a time is kind of arbitrary when you think about it. I could even see having commands that take multiple CWDs. Like a move operation could take a source and a destination CWD as an alternative to specifying source and destination paths.
- Dylan16807 5y agoDirectory file descriptors already exist. I wouldn't call them "current working" directories though. Are you suggesting an expansion of those, or something different from those?
- oalae5niMiel7qu 5y agoIt's a consequence of living in a society where everything is about money. You absolutely could build a better operating system, but doing so wouldn't make you any money, so nobody can afford to do it.