You are on page 1of 50

BÀI GIẢNG - HỆ ĐIỀU HÀNH

 GIẢNG VIÊN: Th.S VŨ QUỐC HƯNG


 Khoa Công Nghệ Thông Tin
 Email:hungvq@vaa.edu.vn
NỘI DUNG
CHƯƠNG 6: QUẢN LÝ HỆ THỐNG TẬP TIN
(FILES)
 6.1 Giới thiệu hệ thống file
 6.2 Giao tiếp sử dụng phân hệ quản lý file
 6.3 Giao tiếp sử dụng phân hệ quản lý thư mục
 6.4 Hiện thực file
 6.5 Hiện thực thư mục
 6.6 Quản lý các cluster chưa dùng
 6.7 Các việc quản lý khác trên hệ thống file
 6.8 Quản lý hệ thống file trên máy PC
6.1 GIỚI THIỆU HỆ THỐNG FILE
File là chuỗi các bytes thông tin được lưu trữ trên thiết bị đĩa.
6.1 GIỚI THIỆU HỆ THỐNG FILE
Tính dung lượng ổ cứng HDD

Capacity= head x cylinder x sector x 512 bytes


6.1 GIỚI THIỆU HỆ THỐNG FILE
Tính dung lượng ổ cứng SSD

Capacity=
 Number of NAND chips per drive
 Number of data cells on each chip
 Number of bits per cell.
 Number of chips depends on the SSD's form factor
 Types of chips used and how many chips the
manufacturer chooses to add to the device
6.1 GIỚI THIỆU HỆ THỐNG FILE
6.1 GIỚI THIỆU HỆ THỐNG FILE
 PC lưu data trên nhiều phương
tiện lưu trữ khác nhau, như đĩa từ,
băng từ, đĩa quang.
 OS trừu tượng từ các thuộc tính
vật lý của các thiết bị lưu trữ của
nó đến định nghĩa một đơn vị lưu
trữ luận lý là tập tin (file).
 Tập tin được ánh xạ bởi hệ điều
hành trên các thiết bị vật lý.
 Các thiết bị lưu trữ CẦN ổn định để
nội dung không bị mất khi mất
điện hay khởi động lại hệ thống
6.1 GIỚI THIỆU HỆ THỐNG FILE
Master
Boot
Record
6.1 GIỚI THIỆU HỆ THỐNG FILE
Quá trình khởi động hệ thống Chương trình
bootstrap (dùng nạp &
thực thi các boot
loader của OS) lưu giữ
ở ROM

Power On Self
Test (POST)
6.1 GIỚI
THIỆU HỆ
Sector 0
THỐNG FILE

Cấu trúc luận lý của


một đĩa cứng
 MBR
 Partition table
 Partitions
6.1 GIỚI THIỆU HỆ THỐNG FILE
Một số bootloader quan trọng
Tên bootloader Mô tả
Bootmgr boot program cho các hệ thống Microsoft từ Windows
Vista và Windows Server 2008
NT loader (NTLDR) boot program cho hệ thống Microsoft từ Windows XP và
Windows Server 2003
barebox bootloader cho hệ thống nhúng trong máy in, camera, xe
hơi, máy bay, và nhiều hơn nữa
EFI bootloader đã được dùng trong các thiết bị Mac từ
boot.efi năm 2006
BootX chomer bootloader cho hệ điều hành Mac
Grand Unified Bootloader boot program miễn phí dành cho hệ điều hành dựa trên
(GRUB) Unix như Linux
ARM Core Bootloader bootloader cho microcontrollers (được dùng trong
iPhones và những thiết bị khác)
boot manager miễn phí, portable dưới giấy phép GNU-
OpenBIOS GPL
bootmgr
On
WINDOWS 11
6.1 GIỚI THIỆU HỆ THỐNG FILE
6.2 QUẢN LÝ FILE
 File Attributes
FILE ATTRIBUTE IN WINDOWS
 https://learn.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants
FILE ATTRIBUTE IN LINUX
 https://linuxopsys.com/topics/show-file-attributes-in-linux
6.2 QUẢN LÝ FILE
Các OS thường hỗ trợ ba cấu trúc tập tin thông dụng là:
 Không có cấu trúc: tập tin là một dãy tuần tự các byte
 Có cấu trúc: tập tin là một dãy các mẫu tin có kích thước cố định
 Cấu trúc cây: tập tin gồm một cây của những mẫu tin không cần
thiết có cùng chiều dài, mỗi mẫu tin có một trường khoá giúp
việc tìm kiếm nhanh hơn

In-Use
6.2 QUẢN LÝ FILE
BSS
Block Starting Symbol

Phân loại File


- (a) An executable file
- (b) An archive

(a) (b)
Executable file Archive file
FREE SPACE MANAGEMENT IN OS
 https://www.geeksforgeeks.org/free-space-management-in-operating-system/

Bitmap/Bit vector
Linked list

Grouping

Counting
EXECUTIVE FILES
 https://en.wikipedia.org/wiki/Comparison_of_executable_file_formats

Executable and
Linkable Format

.EXE files cannot run


Portable directly on Linux
Executable (PE)
format
File Operations

1. Create
7. Append
2. Delete
8. Seek
3. Open
9. Get attributes
4. Close
10.Set
5. Read Attributes
6. Write 11.Rename
21
6.3 QUẢN LÝ THƯ MỤC

A hierarchical directory system


22
LỆNH DI CHUYỂN GIỮA CÁC
THƯ MỤC
 CD = Change Directory
ĐƯỜNG DẪN TƯƠNG ĐỐI (RELATIVE PATH )

& TUYỆT ĐỐI (ABSOLUTE PATH )


Path Description

C:\Documents\Newsletters\Summer2018.pdf An absolute (file) path from the root of drive C:.

\Program Files\Custom Utilities\StringFinder.exe A relative path from the root of the current drive.

2018\January.xlsx A relative path to a file in a subdirectory of the


current directory.

..\Publications\TravelBrochure.pdf A relative path to a file in a directory starting from


the current directory.

C:\Projects\apilibrary\apilibrary.sln An absolute path to a file from the root of drive C:.

C:Projects\apilibrary\apilibrary.sln A relative path from the current directory of


the C: drive.
ĐƯỜNG DẪN TƯƠNG ĐỐI (RELATIVE PATH )

& TUYỆT ĐỐI (ABSOLUTE PATH )


Absolute path Relative path
Đường dẫn tuyệt đối của một tệp tin hay Đường dẫn tương đối thì sử dụng không
thư mục đều bắt đầu bởi thư mục gốc / đòi hỏi phải bắt đầu từ / (root) mà có thể
(root) và theo cây, theo nhánh, cho đến tiếp cận được với các thư mục hay tệp tin
thư mục hoặc tệp mong muốn <==> một bên trong thư mục hiện hành (working
đường dẫn tuyệt đối là đường dẫn bắt đầu directory)
bởi / (root).
cd /usr/bin cd ../../usr/bin

A relative path to a file in a subdirectory of the 2018\January.xlsx


current directory.

A relative path to a file in a directory starting from ..\Publications\TravelBrochure.pdf


the current directory.

An absolute path to a file from the root of drive C:. C:\Projects\apilibrary\apilibrary.sln

A relative path from the current directory of C:Projects\apilibrary\apilibrary.sln


the C: drive.
ĐƯỜNG DẪN TƯƠNG ĐỐI (RELATIVE PATH )

& TUYỆT ĐỐI (ABSOLUTE PATH )


Đường dẫn trong HTML
Đường dẫn Mô tả

<img src=”picture.jpg” picture.jpg đặt cùng thư mục với trang hiện tại

<img src="images/picture.jpg"> picture.jpg đặt trong thư mục images trong thư mục hiện tại

picture.jpg đặt trong thư mục images ở thư mục gốc của trang web
<img src="/images/picture.jpg">
hiện tại

<img src="../picture.jpg"> picture.jpg đặt trong thư mục tăng một cấp so với thư mục hiện tại

Absolute path Relative path


<img src="https://www.w3schools.com/ <img src="/images/
images/picture.jpg" alt="Mountain"> picture.jpg" alt="Mountain">
Directory Operations

1. Create 5. Readdir
2. Delete 6. Rename
3. Opendir 7. Link
4. Closedir 8. Unlink

27
TRUY CẬP THƯ MỤC
XEM VỊ TRÍ VẬT LÝ CỦA FILE

 DiskView (SysInternals Suite)


SO SÁNH FILE & FOLDER
SN Based on File Folder
1. Basic - A collection of related data or - A storage space used for storing files,
information. shortcuts, or other folders on a
OS chỉ cấp - Are stored on hard drives, optical drives,
computer.
không gian lưu discs, or other storage devices in the -
A way to organize files into groups
computer system. and placed them under a common
trữ cho FILES heading.
2. Container - Does not contain another file or folder - Contains any number of files and
in it. folders in it.
- Works as a container to store data. - Works as a container to store related
files or folders.
3. Size The file has a memory consumption and A folder does not have its own size. The
actual size (ON DISK…). size of the folder is derived from the files it
includes.
4. Extension - Files may or may not have extensions. Folders do not have any extensions.
They can have extensions to represent the
program's type they belong to.
5. Operations Operations: open, print, move, rename, Operations:delete, share, rename, move,
save, modify, email, etc. etc.

6. Share Files cannot be shared on the network by They can be shared on the network.
themselves.
DISK PROCESS
DISK PROCESS
DISK PROCESS
DISK PROCESS
DISK PROCESS
DISK PROCESS
DISK PROCESS
DISK PROCESS
DISK PROCESS
DISK PROCESS
DISK PROCESS
DISK PROCESS
DISK PROCESS
DISK PROCESS

Đĩa cứng có 200 cylinder (từ 0 đến 199). Đầu từ


đang ở cylinder số 53. Hàng đợi đang có các yêu
cầu truy xuất đĩa cứng tại các cylinder 98, 183,
37, 122, 14, 124, 65, 67. Hỏi thứ tự phục vụ của
thuật toán First Come First Serve (FCFS)
DISK PROCESS

Đĩa cứng có 200 cylinder (từ 0 đến 199). Đầu từ đang ở cylinder
số 53. Hàng đợi đang có các yêu cầu truy xuất đĩa cứng tại các
cylinder 98, 183, 37, 122, 14, 124, 65, 67. Hỏi thứ tự phục vụ của
thuật toán Shortest-Seek-Time First (SSTF)
DISK PROCESS

Đĩa cứng có 200 cylinder (từ 0 đến 199). Đầu từ đang ở cylinder
số 53. Hàng đợi đang có các yêu cầu truy xuất đĩa cứng tại các
cylinder 98, 183, 37, 122, 14, 124, 65, 67. Hỏi thứ tự phục vụ
của thuật toán SCAN
DISK PROCESS

Đĩa cứng có 200 cylinder (từ 0 đến 199). Đầu từ đang ở cylinder
số 53. Hàng đợi đang có các yêu cầu truy xuất đĩa cứng tại các
cylinder 98, 183, 37, 122, 14, 124, 65, 67. Hỏi thứ tự phục vụ của
thuật toán C-SCAN
DISK PROCESS

Đĩa cứng có 200 cylinder (từ 0 đến 199). Đầu từ đang ở


cylinder số 53. Hàng đợi đang có các yêu cầu truy xuất đĩa
cứng tại các cylinder 98, 183, 37, 122, 14, 124, 65, 67. Hỏi thứ
tự phục vụ của thuật toán C-LOOK
DISK PROCESS

class DriveInfo, Directory của .NET


Using System.IO
BÀI TẬP NHÓM

Nhóm Dịch, tóm tắt và trình bày trên lớp Lưu ý chung
1,4,7 - Classic SysAdmin: The Linux Filesystem - DỊCH TRỰC TIẾP
Explained - Linux Foundation (Không cầm bài
- Soạn và giải thích 15 Keywords trong bài dịch Tiếng Việt đọc lại)
- KHÔNG lấy kết quả
dịch trên mạng (Có
thể tham khảo lấy ý
2,5,8 - Overview of FAT, HPFS và các từ chuyên
, and NTFS File Systems - Windows Client | Microsoft nghành)
Learn
- Soạn và giải thích 15 Keywords trong bài dịch - Các Keywords cho
phép soạn trước.
- Trình bày trong vòng
3,6,9 - File system formats available in Disk Utility on Mac 15p (Bấm giờ)
- Apple Support (
VN)
- Soạn và giải thích 15 Keywords trong bài dịch

You might also like