File System
File System
OPERATING SYSTEM
1. Concepts
2. File access methods
3. Actions with files
4. Folders
5. Allocating space for files
6. Manage free disk space
7. File system reliability
8. File system security
9. FAT File System
MS-DOS 8 cho tên file không không Bắt đầu bằng chữ cái hoặc số
3 cho mở rộng Không được chứa các ký tự / \ [ ] : ; | = , ^ ?
@
Windows NT 255 ký tự cho cả tên không có Bắt đầu bằng chữ cái hoặc số
FAT file và đường dẫn Không được chứa các ký tự / \ [] : ; | = , ^ ?
@
Windows NT 255 không có Không được chứa các ký tự / \ < > * | :
NTFS
Linux (EXT3) 256 Có có (nếu tên file chứa Không được chứa các ký tự ! @ # $ % ^ & *
trong ngoặc kép) ()[]{}‘“/\:;<>`
▪ File Structure:
▪ The information in the file can be very different
▪ There are files that contain a lot of unstructured information: text
files. Structured files such as: database files, excel files.
• => The structure of the file is also very different and depends on the
information contained in the file
▪ Does OS need to know and support file structure types?
▪ Pros:
• Manipulation with files will be easier for application developers
• The operating system can control the operations with the file
▪ Cons:
• Increase system size
• The flexibility of OS is reduced
www.ptit.edu.vn GIẢNG VIÊN: THS NGUYỄN THỊ NGỌC VINH
Trang 6
BỘ MÔN: KHOA HỌC MÁY TÍNH – KHOA CNTT1
QUESTIONS
▪ Metric-based access:
▪ Allows access to records in a file, not by the order or location of the
records in the file, but by the key corresponding to that record.
▪ The file contains a unique indicator: it contains keys and pointers
pointing to the records in the file.
▪ Access: find the corresponding key in the index, then follow the pointer
that identifies the record and access it directly
Thư mục
branches are
folders, leaves
are files
▪ Tree structure:
▪ Differentiate between file items and subfolder items: add special
bits to the item
• 1: Items of the lower level folder
• 0: Item of the file
▪ At each point, the user works with the current directory
▪ Organize the folder tree for each disk:
• In a file system like DOS's FAT, a folder tree is built for each disk. The
directory system is considered forested, each tree on 1 disk
• Linux: the whole system consists of only 1 directory tree
▪ List:
▪ Organize folders as a list of items
▪ Searching for items is done by browsing the list one by one
▪ Add new files to the folder:
▪ Browse the entire folder to check if the item with such a file name already
exists
▪ A new item is added to the bottom of the list or 1 cell in the table.
▪ Open the file, delete the file
▪ Search in the slow list
▪ Store folders in memory
▪ Binary Tree:
▪ Speed up your search with a sortable database
▪ NTFS File System in WinNT.
▪ Hash table:
▪ Use the hash function to calculate the location of items in the
folder by file name
▪ Fast search time
▪ The hash function depends on the size of the hash table => fixed
table size
External fragmentation
▪ Các khối thuộc về mỗi file được kết nối với nhau thành
danh sách kết nối; phần đầu mỗi khối chứa con trỏ trỏ tới
khối tiếp theo
▪ Các khối thuộc về 1 file có thể nằm ở vị trí bất kì trên đĩa
▪ Khoản mục của thư mục chứa con trỏ tới khối đầu tiên của
file
▪ Khi file được cấp thêm khối mới, khối đó được thêm vào
cuối danh sách
▪ HDH đọc lần lượt từng khối và sử dụng con trỏ để xác
định khối tiếp theo
▪ Advantage:
▪ Allow direct access
▪ Blocks in 1 file do not need to be contiguous.
▪ Disadvantage:
▪ Slow file access speed
▪ The FAT system was designed for use in DOS, which was
later used in some versions of Windows 3.0,3.1,95/98.
▪ Currently, FAT is still a common system, used in most
operating systems today to manage memory cards, floppy
disks, CDs
▪ 3 versions: FAT12, FAT16, FAT32
▪ The digit indicates the FAT table cell size of 12, 16 and 32
bits respectively
▪ Currently, FAT32 is often used for hard disks, FAT16 is
used for external memory devices with small capacities
such as CDs and external memory cards.
▪ Boot sector:
▪ The first sector of the logical disk
▪ Contains information describing the logical disk structure:
sector size, cluster, FAT table size
▪ Contains the primer program code to load the OS if the
logical disk is the boot disk
Boot sector Bảng FAT1 Bảng FAT2 Thư mục gốc Phần còn lại cho tới cuối đĩa
và các khối dự phòng (chỉ có trên FAT12 và FAT16) chứa các file và thư mục của đĩa lô gic
36 1 Số thứ tự vật lý của đĩa (0: đĩa mềm, 80h: đĩa cứng .v.v.)
37 1 Dự phòng
38 1 Dấu hiệu của phần mã mồi. Chứa giá trị 0x29 (ký tự ‘)’) hoặc 0x28.
39 4 Số xê ri của đĩa (Volume Serial Number) được tạo lúc format đĩa
62 448 Mã mồi hệ điều hành, đây là phần chương trình tải hệ điều hành khi khởi động.
▪ The first 2 cells of the FAT table are not used for cluster
management
11 1 Bit 0: file chỉ được đọc; Bit 3: Volume label; Bit 6: thiết bị nhớ khác (dùng cho hệ điều
Bit 1: file ẩn; Bit 4: thư mục con hành);
Bit 2: file hệ thống; Bit 5: archive; Bit 7: không sử dụng
Byte thuộc tính bằng 0x0F là dấu hiệu của file tên dài.
12 1 Dự phòng
13 1 Thời gian tạo file tính theo đơn vị 10ms, giá trị từ 0 đến 199
14 2 Thời gian tạo file theo format sau: bit 15-11: giờ (0-23); bit 10-5: phút (0-59); bit 4-0: giây/2 (0-29)
16 2 Ngày tạo file theo format sau. Bit 15-9: năm (0-1980, 127 =2107); bit 8-5: tháng (1-12); bit 4-0: ngày (1-31)
18 2 Ngày truy cập cuối, theo format như ngày tạo file
20 2 2 byte cao của số thứ tự cluster đầu tiên của file trong FAT32
22 2 Thời gian sửa file lần cuối, theo format thời gian tạo file
24 2 Ngày sửa file lần cuôi, theo format như ngày tạo file
26 2 Số thứ tự cluster đầu tiên của file trong FAT12/16.
28 4 Kích thước file tính bằng byte. Bằng 0 với thư mục con