Unix
Context
- This is an older paper for Unix. Therefore, some implementations and designs might be different from what we know for modern unix today.
- Unix has a narrower set of goals compared to Multics, which tried to invent and experiment on a lot of new things.
Goal
- Unifying Abstraction → try to make as many things as possible into files
- Easy to use/Familiar abstraction
- Single (simple) protection model for everything
- Impose more work, but less restriction on programmer
- Modularization
- Streaming I/O interface
Note
What's good about I/O interface is that it works better with devices compared to memory-mapped file access.
Implementation
File System
Unix File System
Unix only has a single hierarchical file system (starting from root). You can attach a file system to this main namespace with mount. Also, everything is a file in the file system (even directories).
// TODO: Insert Diagram
Hard Link
Actual pointer to the file
Soft Link
A file contains the pathname
set user id
When set user id is called in unix on a file, the protection check is not done on the user of the process, but the owner of the process. (e.g. running os programs stored in the /bin/ directory)
In this way, we can do the right augmentation. Unlike Multics, Unix implements a protected subsystem by the level of granularity of processes instead of individual procedures.
We make sure that the protection system is still working by ensuring that the user does not decide which instructions get executed. It can only decide to run the program, but not what the program does. Essentially, this is like gates (entry points) in Multics.
Sudo
sudo is changing your user id as if you are running as a root user.
Shell Code in Unix
1 2 3 4 5 6 7 8 9 10 | |
How can you implement redirection, reassign stdin, and stdout if you don't have fork() and exec?