操作系统 Operating System

  • Upload
    donat

  • View
    57

  • Download
    7

Embed Size (px)

DESCRIPTION

操作系统 Operating System. 教学目的. 通过对本章地讲解使学生理解并掌握文件系统的功能、结构,外存空间的管理和目录结构。. 本章重点:. 文件的逻辑结构和物理结构 文件外存空间的管理 文件目录结构的管理 文件的保护与共享. 本章难点:. 目录的搜索 文件外存空间的管理. 第 6 章 文件系统. 现代计算机系统中,大量的程序和数据总是以文件的形式存放在外存中,需要时随时调入内存。 文件系统是指操作系统中用来管理文件以及对文件进行操作的机制及其实现。 文件系统由三个基本部分组成: 存储数据的文件的集合,组织文件的目录结构,管理文件的软件机构。. - PowerPoint PPT Presentation

Citation preview

  • Operating System

  • 6

    6.1 6.2 6.3 6.4 Linux6.5 Ext26.6 Windows

  • UNIX

  • 6.1 6.1.1 6.1.2 6.1.3 6.1.4 6.1.5 6.1.6 6.1.7 6.1.8

  • 6.1.1 1. 122.

  • 3. 1/23/

  • 1ASCII23

  • 1234

  • 123// 12I/O

  • UNIX123

  • 4UNIX5pipe6socketTCPIPsocket1, socket2

  • 6.1.2 1.

  • 2.2(1) (2)

  • 6.1.3 512B1KB2KB4KB

  • 1. 6.1

  • 2. 6.2

  • ii

  • FATFile Allocation TableMS-DOSOS/2FAT

  • 6-9

  • 6-10 MS-DOS

  • 3. 6.3

  • 6.4

  • 6.1.4 1.RR+lR+l

  • 2.

  • 3.

  • 6.1.5 1.

  • 6-1

  • 2.ijk=16*i+jKi=k/16j=K%161G1KB1M128(1M/8k)1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 11 1 1 0 0 0 0 0 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 0 0 0 0 0 0 0 00 0 0 0 0 1 1 1 0 0 1 1 1 1 0 015 14 9 8 7 6 5 4 3 2 1 0 0 1 2 3

  • 3.

  • UNIX

  • 6.1.6 1.

  • 2.3.

  • 4.5. 6.

  • 6.1.7 /

  • UNIX111 101 001chmod

  • NTFS NTFS(1)(2)(3)

  • (4)ABCC(5)(6)

  • 6.1.8 1.

  • 05r=7200/1/r

  • =++

  • 2.FCFSSSTFSCANCircular SCAN

  • (1) FCFS (First-Come, First Served) 5-23 FCFS

  • (2) SSTF (Shortest Seek Time First) 5-24 SSTF

  • (3) (SCAN) 1) SSTF (Starvation) I/OSSTFSCAN

  • 2) SCAN 5-25 SCAN

  • 6.2 4.2.1 4.2.2 (1)(2)(3)(4)

  • 6.2.1 FCBFile Control Block1.(1)(2)(3)(4)

  • (5)(6)(7)

  • 2.(1)1K641024/64=16N (N+1) /2

  • (2)012

  • 6.2.2 1.

  • 2.

  • 3.4-6

  • /a.out/home/Liu/a.out

  • (1)B(2)BB /B/B/AA/B

  • /B/B/AA/B (3)BAA(4)AAB

  • /usr/ast/mbox (1) usr

    (2) 6

    .1..1bin4dev7lib14etc9usr6tmp8

    1d6d13226d49660f200

  • /usr/ast/mbox usr(3) 132usrast(4) 26

    .6..1are19jkl30hui51ast26lkm45

    1d6d13226d49660f200

  • /usr/ast/mbox ast(5) 496astmbox(6) 60

    (7) 200mbox

    .26..6gran64book92mbox60mini81scr17

    1d6d13226d49660f200

  • 6.3 6.3.1 6.3.2 6.3.3

  • 6.3.1 1.4-7I/O

  • (1)I/O(2)(3)(4)FCB

  • 2.LinuxUNIXVirtual File System SwitchVFSLinuxDOSExt2

  • 4-8openwritecloseVFS (Virtual File System)VFSVVnodeVVFSvfs-operationsVFSNFS (network file system)

  • 3.WindowsWindows 2000 I/OFile System DriverFSDI/OI/OI/OI/ONTFS

  • FSDFSDFSDFSDI/OFSDFSDI/OFSDI/OI/OFSDFSDFSD4-9

  • FSDFSDFSDFSDI/OFSDFSDFSD

  • 6.3.2 primary partitionextended partitionlogical partitionRAID

  • Format2

  • UFSNTFSFCBFCBUFSNTFSMFTFCBUFSi(inode)NTFSMFT

  • FCBFCBFCBI/OI/O

  • FCBFCBUNIXWindows 2000

  • 6-12

  • openUFSi

  • 6.3.3 S5FSUnixVFATFile Allocation TableFAT1982MS-DOSFAT12FAT16FAT32NTFSNew Technology File SystemNTFSWindows NTExt2LinuxMinixUnixHPFSHigh Performance File SystemOS/2NFS

  • 6.4 Linux

    6.4.1 LinuxUNIXVirtual Filesystem SwitchVFS

  • VFSread()write()LinuxVFSfile_operations/filefile_operationsf_opf_opLinuxVFS4-11

  • 6.4.2 VFSsuperblock objectinode objectfile object dentry object

  • 6-12

  • 1.Linuxsuper_block

  • s_listnextprevsuper_blockss_listnextprev6-13

  • uExt2ext2_sb_infous_opsuper_operationsread_inode(inode)write_inode(inode)put_inode(inode)delete_inode(inode)put_super(super)write_super(super)VFSwrite_inode()VFSsb->s_op->write_inode(inode);sb

  • 2.inodeinode_unusedinode_in_uses_dirtyinode_hashtableuExt2ext2_inode_infoi_op

  • 6-3

  • 3.filefile_operationsinode_operationsdefault_file_ops

  • file_operationsreadwriteopenioctlreleasereaddir

  • 4. VFSVFSdentry6-5 /usr/local/usr/usrlocal

  • 6-5

  • 5.fs_structfsStruct fs_struct { atomic_t count; fs_struct int umask; umask() struct dentry * root, * pwd; }

  • files_structfilesfiles_struct6-6 int count int max_fds struct file ** fd struct file * fd_array[32] fdmax_fds32fdmax_fds

  • file descriptor0126-14Unix

  • 6.4.3 VFS1./open ( )sys_open ( )-1close ( )sys_close ( )

  • 2. /read ( )write ( )///

  • inoderead ( )write ( )inode6-16

  • inodepagei_pagespagevirtualpagebuffer_headb_databuffer_headbuffer_headb_data pageinode4buffer_head

  • read ( )write ( )sys_read ( )sys_write ( )fdbufcountread ( )write ( )-1f_pos

  • 6.5 Ext2LinuxMinixMinix64M14LinuxExt FS1994LinuxSecond Extended File System, Ext2Ext2LinuxExt2Ext2

  • 6.5.1 (1)group descriptor(2)

  • Ext2Ext2

  • 001108bbs/8bs8GBExt24KB4KB32K128MB64

  • 1.Ext2ext2_super_block6-7 s_inodes_countExt2s_blocks_countExt2s_log_block_size210240102412048 s_blocks_per_group s_inodes_per_group

  • 6-7 Ext2 __u32 s_log_block_size __u32 s_blocks_per_group __u32 s_free_blocks_count __u32 s_inodes_count __u32 s_inodes_per_group __u32 s_free_inodes_count __u32 s_blocks_count __u32 s_creator_os __u16 s_inode_size __u8 [16] s_uuid 128char [16] s_volume_name char [64] s_last_mounted

  • 2.ext2_group_desc

  • 3.bg_inode_table12810248Ext2ext2_inode6-9bg_free_blocks_countbg_free_inodes_countbg_used_dirs_count

  • 6-9 Ext2

  • 0110242048409681921638432768i_sizei_blocks512i_blockEXT2_N_BLOCKS15

  • 6.5.2 Ext2Ext2RAM06-10 Ext2VFS

  • shrink_mmap( )

  • 1.ext2_sb_infoext2_inode_infoExt2Ext2Ext2ext2_sb_infoExt2VFSuExt2ext2_inode_infoVFSu

  • ext2_sb_infoVFSs_inode_bitmaps_inode_bitmap_numbers_block_bitmaps_block_bitmap_numbers_sbhs_ess_desc_per_blocks_group_desc

  • ext2_inode_infoi_block_groupi_alloc_blocki_alloc_counti_osync

  • 2.RAM8GB1KB81928GB/8MB=102420482MBRAMExt2EXT2_MAX_GROUP_LOADED 8

  • 9(a)9(b)9(c)9

  • ext2_sb_infoExt26-19ext2_sb_infos_group_desc242EXT2_MAX_GROUP_LOADED

  • 6.5.3 Ext2Ext2ext2_sopsVFSclear_inodeumount_beginVFSExt2Ext2ext2_file_inode_operationsext2_dir_inode_operationsioctl(fd, cmd, arg )cmdfdcmdarg

  • 6.5.4 Ext2fffLinuxUnixff4KBf4096f0f40968192f1

  • 1225(b/4)2+(b/4)+12b/4+12(b/4)3+(b/4)2+(b/4)+11i_block012345678910111213144-20 Ext2i_blocki_blockEXT2_N_BLOCKSEXT2_N_BLOCKS154-2015412121212b/4+11b413b/4+12 (b/4)2+(b/4)+1114 (b/4)2+(b/4)+12(b/4)3+(b/4)2+(b/4)+11UNIXV12

  • 6.6 WindowsWindows 2000CDFSUDFFAT12FAT16FAT32NTFSCDFSCDROM File System1988UDFWindows 2000CDFSUDFUniversal Disk Format1995DVD-ROMCDFSFATFile Allocation TableWindows 2000FATFATWindows 2000512B8KBFAT12122124096FAT1616FAT3232Windows 200032GBFAT21Windows NTNTNTFS (New Technology File System)NTFSNTFSIntelNTFSNTFSNTFSNTFSAtomic transactionEncrypted File System, EFSNTFS

  • 6.6.1 NTFS NTFSFATNTFSNTFS22GB4KBNTFSLogical Cluster Number, LCNVirtual Cluster Number, VCNLCNVCNVCNLCN

  • 1.FATNTFSMaster File Table, MFTFATNTFSmetadataMFTNTFSNTFSNTFSNTFSMFTMFTMFT1KBMFT16$16MFT6-12

  • 6-12 MFT

  • MFT16NTFS4-22MFTMFT166-22 MFTNTFS12%88%MFTWindowsMFTMFTNTFSMFTNTFS$BootMFTVCNLCNMFTNTFSMFTNTFS

  • 2.NTFS64File Reference Number48MFT16NTFS

  • 3.NTFSUnicodeUnicode16VCNLCNVCNVCNMFTstreamNTFSNTFS/

  • NTFSMFTNTFS NTFSMFTMFT6-231236-24 MFT6-24

  • 1KBMFTNTFSMFTMFTrunextentMFTNTFS

  • 6-25 6-25NTFSVCN-LCNVCN-LCNMFT6-262VCN 8attribute listMFTVCN-LCNVCNLCN67145214531325132613279 11 \48.4-28 VCNLCN012345135 6 712011202120312337.6-27 1 24 5 6 MFT6-27

  • NTFS4KB6-28VCNVCN4KB20306-27NTFSB+B+B+NTFSB+6-27NTFSVCNLCNVCN

  • 6.6.2 NTFS Win32 I/O APII/OI/OFSDI/OI/O6-29/I/ONTFS

    NTFSNTFSSCBSystem Control BlockSCBSCBFCBFCBNTFS6-30