งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

การจัดการระบบแฟ้ม File-System Management

งานนำเสนอที่คล้ายกัน


งานนำเสนอเรื่อง: "การจัดการระบบแฟ้ม File-System Management"— ใบสำเนางานนำเสนอ:

1 การจัดการระบบแฟ้ม File-System Management
นงลักษณ์ พรมทอง และวิเชษฐ์ พลายมาศ การจัดการระบบแฟ้ม File-System Management

2 Learning Objectives เพื่อศึกษาหลักการจัดการระบบแฟ้ม
เพื่อให้เข้าใจถึงโครงสร้างของแฟ้ม และสารบบ รวมทั้ง คุณลักษณะประการต่างๆ ของแฟ้ม และการจัดการแฟ้ม

3 File-System Management
File Concept Access Methods Directory Structure File System Mounting File Sharing Protection

4 แนวคิดเกี่ยวกับแฟ้ม File Concept
แฟ้ม คือ พื้นที่อยู่เชิงตรรกะที่เรียงต่อเนื่องกัน (Contiguous logical address space) Types: แฟ้มข้อมูล (Data file) numeric character binary แฟ้มโปรแกรม (Program file)

5 แนวคิดเกี่ยวกับแฟ้ม File Concept
คุณลักษณะของแฟ้ม เช่น ชื่อ, ตัวระบุ (identifier), ประเภท, ที่อยู่, ขนาด, การป้องกัน, วัน เดือน ปี และข้อมูลเกี่ยวกับผู้ใช้ คำสั่งปฏิบัติการเกี่ยวกับแฟ้ม เช่น การสร้าง, การเขียน, การอ่าน, การย้ายตำแหน่งภายใน, การลบ, การตัดทิ้ง OS บางชนิด จะมี ตัวชี้แฟ้ม (File pointer), การนับการเปิดแฟ้ม, ตำแหน่งหน่วยเก็บแฟ้ม, สิทธิการเข้าถึง (access rights) เป็นต้น ประเภทของแฟ้ม ประกอบด้วยชื่อ (file name) และส่วยขยาย (file extension) โครงสร้างแฟ้ม และแฟ้มสนับสนุน โครงสร้างแฟ้มภายใน อาจเป็นตำแหน่งของ offset, block, sector เพื่อใช้ในการแปลงจากที่อยู่เชิงตรรกะ (logical address) ไปเป็นที่อยู่เชิงกายภาพ (physical address)

6 Operating System Concepts
File Structure ไม่มี (None) – เป็นลำดับของ words หรือ bytes โครงสร้างระเบียนอย่างง่าย (Simple record structure) Lines Fixed length Variable length โครงสร้างซับซ้อน (Complex Structures) Formatted document Relocatable load file ผู้ตัดสินเลือกโครงสร้างของแฟ้ม Operating system Program Operating System Concepts

7 Operating System Concepts
File Attributes Name – only information kept in human-readable form. Type – needed for systems that support different types. Location – pointer to file location on device. Size – current file size. Protection – controls who can do reading, writing, executing. Time, date, and user identification – data for protection, security, and usage monitoring. Information about files are kept in the directory structure, which is maintained on the disk. Operating System Concepts

8 Operating System Concepts
File Operations Create Write Read Reposition within file – file seek Delete Truncate Open(Fi) – search the directory structure on disk for entry Fi, and move the content of entry to memory. Close (Fi) – move the content of entry Fi in memory to directory structure on disk. Operating System Concepts

9 File Types – Name, Extension

10 Access Methods การเข้าถึงโดยลำดับ (Sequential Access) read next
write next reset no read after last write (rewrite) การเข้าถึงโดยตรง (Direct Access) read n write n position to n rewrite n n = relative block number

11 Sequential-access File

12 Simulation of Sequential Access on a Direct-access File

13 Example of Index and Relative Files

14 Directory Structure กลุ่มของโหนดต่างๆ ที่บรรจุไว้ด้วยข้อมูลเกี่ยวกับแฟ้มทั้งหมด Directory Files F 1 F 2 F 3 F 4 F n ทั้ง directory structure และ files ที่อยู่บนดิสก์ เวลาสำรองข้อมูลจะต้องเก็บโครงสร้างทั้งคู่ไว้บนเทป

15 A Typical File-system Organization

16 Information in a Device Directory
Name Type Address Current length Maximum length Date last accessed (for archival) Date last updated (for dump) Owner ID (who pays) Protection information (discuss later)

17 Operations Performed on Directory
Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system

18 เกณฑ์การจัดองค์กรสารบบเชิงตรรกะ
ความสะดวก (Efficiency) – เพื่อให้ค้นหาไฟล์ได้อย่างรวดเร็ว โดยชื่อ (Naming) – เพื่อความสะดวกต่อผู้ใช้ โดยกลุ่ม (Grouping) – กลุ่มเชิงตรรกะตามคุณลักษณะของแฟ้ม เช่น all Java programs, all games, …

19 Single-Level Directory
มีสารบบเดียวสำหรับผู้ใช้ทุกคน Naming problem Grouping problem

20 Two-Level Directory แยกสารบบตามผู้ใช้แต่ละคน Path name
ผู้ใช้สามารถตั้งชื่อแฟ้มเหมือนกัน ง่ายต่อการค้นหา ไม่สามารถแบ่งตามความจุที่ใช้

21 Tree-Structured Directories

22 Tree-Structured Directories (Cont.)
ง่ายต่อการค้นหา (Efficient searching) ตามความจุของกลุ่ม (Grouping Capability) สารบบปัจจุบัน (Current directory) สารบบที่ทำงาน (working directory) cd /spell/mail/prog type list

23 Tree-Structured Directories (Cont.)
ชื่อเส้นทาง (path name) เชิงสัมบูรณ์ (Absolute) หรือเชิงสัมพัทธ์ (relative) การสร้างชื่อแฟ้มเสร็จแล้วในสารบบปัจจุบัน Delete a file rm <file-name> การสร้างสารบบย่อยในสารบบปัจจับน mkdir <dir-name> Example: if in current directory /mail mkdir count mail prog copy prt exp count Deleting “mail”  deleting the entire subtree rooted by “mail”.

24 สารบบกราฟแบบมีวง Acyclic-Graph Directories
มีการใช้ร่วมกันของ subdirectories และ files

25 Acyclic-Graph Directories (Cont.)
มีสองชื่อที่แตกต่างกัน (ชื่อพ้องกัน-aliasing) ถ้า dict ถูกลบไป list  จะเป็นพอนย์เตอร์ลอย (dangling pointer) Solutions: ใช้พอยน์เตอร์ย้อนกล้บ (Backpointers), จึงสามารถลบทุกพอยน์เตอร์ได้ ระเบียนที่มีขนาดแปรผัน (Variable size records) ได้จะมีปัญหา ใช้พอยน์เตอร์ย้อนกล้บ (Backpointers) โดยใช้การจัดองค์กรแบบ daisy chain organization Entry-hold-count solution.

26 General Graph Directory

27 General Graph Directory (Cont.)
ทำอย่างไรจึงรับประกันว่าไม่มีวงกลม (no cycles)? ยินยอมให้มีเพียง link ไปยัง files ไม่ใช่ subdirectories แต่จะสะสมขยะ ทุกครั้งที่เพิ่มลิงก์ใหม่ ให้ใช้อัลกอริธึมการตรวจหาวงกลม (cycle detection algorithm) เพื่อดูว่าเกิดปัญหาหรือไม่

28 File System Mounting file system จะต้องมีการ mounted ก่อนเริ่มใช้งาน
unmounted file system จะ mounted ณ mount point.

29 (a) Existing. (b) Unmounted Partition

30 Mount Point

31 การแบ่งปันแฟ้ม File Sharing
การใช้แฟ้มร่วมกันเป็นสิ่งที่ต้องการบนระบบ multi-user systems การแบ่งปันอาจแบ่งปันผ่าน protection scheme บนระบบกระจาย (distributed systems) การแบ่งปันแฟ้มอาจทำข้ามเครือข่าย Network File System (NFS) จึงเป็นวิธีการทั่วไปที่ใช้ในการแบ่งปันระบบแฟ้มบนระบบกระจาย (distributed file-sharing method)

32 Protection เจ้าของหรือผู้สร้างแฟ้ม (File owner/creator) ควรสามารถควบคุม สามารถทำอะไรได้บ้าง โดยใคร ประเภทการเข้าถึง (Types of access) Read Write Execute Append Delete List

33 Access Lists and Groups
โหมดการเข้าถึง (Mode of access): read, write, execute ประเภทผู้ใช้ RWX a) owner access 7  RWX b) group access 6  1 1 0 c) public access 1  0 0 1 Ask manager to create a group (unique name), say G, and add some users to the group. For a particular file (say game) or subdirectory, define an appropriate access. owner group public chmod 761 game Attach a group to a file chgrp G game


ดาวน์โหลด ppt การจัดการระบบแฟ้ม File-System Management

งานนำเสนอที่คล้ายกัน


Ads by Google