Chapter 1. Introduction | | | | | | | | |
| 1.4Basic Operating System Concepts | | | | | | |
| | Multiuser Systems | | | | | | | |
| | Users and Groups | | | | | | | |
| | Processes | | | | | | | |
| | Kernel Architecture | | microkernel | | | | | |
| | | | | monolithic | | | | | |
| | | | | modules | | | | | |
| | | | | | | | | | |
| 1.5. An Overview of the Unix Filesystem | | | | | | |
| | current working directory | | | | | | |
| | absolute/relative directory | | | | | | |
| | | | | | | | | | |
| | Hard and Soft Links | | $ ln p1 p2 | create a new hard link that has the pathname p2 for a file identified by the pathname p1. |
| | | | | | Hard links limitations: | | |
| | | | | | It is not possible to create hard links for directories |
| | | | | | Links can be created only among files included in the same filesystem |
| | | | | $ ln -s p1 p2 | creates a new soft link with pathname p2 that refers to pathname p1 |
| | | | | | | | | | |
| | File Types | | | file -h filename | | | | |
| | | Regular file | | | | | | | |
| | | Directory | | | | | | | |
| | | Symbolic link | | | | | | | |
| | | Block-oriented device file | | | | | | |
| | | Character-oriented device file | | | | | |
| | | Pipe and named pipe (also called FIFO) | | | | | |
| | | Socket | | | | | | | |
| | | | | | | | | | |
| | File Descriptor and Inode | | | | | | | |
| | | inode | | | | | | | |
| | | | File type (see the previous section) | | | | |
| | | | Number of hard links associated with the file | | | |
| | | | File length in bytes | | | | | |
| | | | Device ID (i.e., an identifier of the device containing the file) | | |
| | | | Inode number that identifies the file within the filesystem | | |
| | | | UID of the file owner | | | | | |
| | | | User group ID of the file | | | | | |
| | | | Several timestamps that specify the inode status change time, the last access time, and the last modify time |
| | | | Access rights and file mode | | | | |
| | | | | | | | | | |
| | Access Rights and File Mode | | | | | | |
| | | suid | | | | | | | |
| | | sgid | | | | | | | |
| | | sticky | | | | | | | |
| | | | | | | | | | |
| | File-Handling System Calls | | | | | | |
| | | fd = open(path, flag, mode) | | | | | |
| | | | | | | | | | |
| | Accessing an opened file | | | | | | | |
| | | sequentially or randomly | | | | | | |
| | | | nread = read(fd, buf, count); | | | | |
| | | | write( ) | | | | | | |
| | | | newoffset = lseek(fd, offset, whence); | | | |
| | | | | | | | | | |
| | Closing a file | | | | | | | |
| | | res = close(fd); | | | | | | | |
| | | res = rename(oldpath, newpath); | | | | | |
| | | res = unlink(pathname); | | | | | | |
| | | | | | | | | | |
| 1.6. An Overview of Unix Kernels | | | | | | | |
| | User Mode | | | | | | | |
| | Kernel Mode | | | | | | | |
| | kernel thread | | | | | | | |
| | system call | | | | | | | |
| | kernel routines can be activated in several ways: | | | | | |
| | | system call | | | | | | | |
| | | exception | | | | | | | |
| | | interrupt | | | | | | | |
| | | kernel thread | | | | | | | |
| | Reentrant Kernels | | | | | | | |
| | reentrant function | | | | | | | |
| | control path | | | | | | | |
| | private Process Address Space | | | | | | |
| | synchronization | | | | | | | |
| | critical region | | | | | | | |
| | Each semaphore may be viewed as an object composed of: | | | | |
| | | An integer variable | | | | | | |
| | | A list of waiting processes | | | | | |
| | | Two atomic methods: down( ) and up( ) | | | | | |
| | Spin locks | | | | | | | | |
| | fork( ) | | | | | | | | |
| | exec( ) | | | | | | | | |
| | exit( ) | | | | | | | | |
| | wait4( ) | | | | | | | | |
| | | | | | | | | | |
| | MMU | | | | | | | | |
| | Virtual memory | | | | | | | |
| | | | | | | | | | |
| | Kernel Memory Allocator(KMA) | | | | | | |
| | | It must be fast | | | | | | |
| | | It should minimize the amount of wasted memory | | | | |
| | | It should try to reduce the memory fragmentation problem | | | |
| | | It should be able to cooperate with the other memory management subsystems to borrow and release page frames from them |
| | | · Resource map allocator | | | | |
| | | · Power-of-two free lists | | | | |
| | | · McKusick-Karels allocator | | | | |
| | | · Buddy system | | | | | |
| | | · Mach's Zone allocator | | | | |
| | | · Dynix allocator | | | | | |
| | | · Solaris 's Slab allocator | | | | |
| | demand paging | | | | | | | |
| | Copy On Write | | | | | | | |
| | | | | | | | | | |