tailieunhanh - Bài giảng Nhập môn Hệ điều hành: File system (Hard Link - Soft Link) - Nguyễn Xuân Vinh

Chương này sẽ giới thiệu về hệ thống file trong hệ điều hành. Thông qua chương này người học sẽ nắm bắt được các thành phần của file, về hardlinked và soft link (symbolic link, symlink),. để nắm bắt các nội dung chi tiết. | FILE SYSTEM Nguyễn Xuân Vinh nguyenxuanvinh@ NHẬP MÔN HỆ ĐIỀU HÀNH INTRODUCTION TO OPERATING SYSTEMS [214242] Hard Link - Soft Link File Parts Unix files consist of two parts: Data part: associated with Inode which carries the map of where the data is, the file permissions, Filename part : carries a name and an associated inode number. Hardlinked More than one filename can reference the same inode number These files are said to be “hard linked” together The specific location of physical data. Soft link (symbolic link, symlink) Special file type whose data part carries a path to another file OS recognizes the data as a path, and redirects opens, reads, and writes so that, instead of accessing the data within the special file A symbolic path indicating the abstract location of another file. Directory The directory, as a file, is just an array of filename parts of other files When a directory is built, it is initially populated with the filename parts of two special files: the “.” and “” files. The filename part for the “.” file is populated with the inode# of the directory file in which the entry has been made. “.” is a hardlink to the file of the current directory. The filename part for the “” file is populated with the inode# of the directory file that contains the filename part of the current directory file. “” is a hardlink to the file that implements the immediate parent of the current directory. Restrictions Hardlinked: Both links must reside on the same filesystem. The source file must exist. Hard links shouldn’t link directories. Softlinks: Source and target can be on separate file systems. Source does not have to exist. Additional I/O necessary to complete file access Additional storage taken up by softlink file’s data Hard links in general are not particularly problematic. But hard links to directories are, which is why you have to use the -d flag to attempt to make one, and why you will probably not succeed anyway; the kernel is . | FILE SYSTEM Nguyễn Xuân Vinh nguyenxuanvinh@ NHẬP MÔN HỆ ĐIỀU HÀNH INTRODUCTION TO OPERATING SYSTEMS [214242] Hard Link - Soft Link File Parts Unix files consist of two parts: Data part: associated with Inode which carries the map of where the data is, the file permissions, Filename part : carries a name and an associated inode number. Hardlinked More than one filename can reference the same inode number These files are said to be “hard linked” together The specific location of physical data. Soft link (symbolic link, symlink) Special file type whose data part carries a path to another file OS recognizes the data as a path, and redirects opens, reads, and writes so that, instead of accessing the data within the special file A symbolic path indicating the abstract location of another file. Directory The directory, as a file, is just an array of filename parts of other files When a directory is built, it is initially populated with the filename parts of two special files:

TỪ KHÓA LIÊN QUAN