File Managementإدارة الملفات

الشريحة 1 من 13

مقدمة الفصل

تفاصيل المصدرشرائح الفصل 4a · الشريحة ⁦2⁩
المصدر
شرائح الفصل 4a · الشريحة ⁦2⁩
ملاحظات حول المصدر (1)
  • المخطط يذكر أمن نظام الملفات وأنظمة ملفات يونكس ولينكس وويندوز، ولا توجد شرائح عنها في هذا الملف.

Files and file management systemsالملفات ونظام إدارتها

  • Files are the central element to most applications; the file system is one of the most important parts of the OS to a user.

Desirable properties of files (slide 3)

  • Long-term existence
  • Sharable between processes
  • Structure
File management system
System utility programs that run as privileged applications, concerned with secondary storage; it provides services in the use of files, so the programmer does not need to develop file management software.

Typical operations (slide 5)

  • Create
  • Delete
  • Open
  • Close
  • Read
  • Write
تفاصيل المصدرشرائح الفصل 4a · الشرائح ⁦3–6⁩
المصدر
شرائح الفصل 4a · الشرائح ⁦3–6⁩

Objectives and elements of file managementأهداف إدارة الملفات

Files and file management systems

  1. 1Meet the data management needs of the user
  2. 2Guarantee that the data in the file are valid
  3. 3Optimize performance
  4. 4Provide I/O support for a variety of storage device types
  5. 5Minimize lost or destroyed data
  6. 6Provide a standardized set of I/O interface routines to user processes
  7. 7Provide I/O support for multiple users (if needed)
Elements of file management (Figure 12.2, slide 8)

File management concerns

  • Directory management
  • User access control
  • File structure
  • Access method
  • Records

Operating system concerns

  • Blocking
  • Disk scheduling
  • File allocation
  • Free storage management

Which of the following is listed as an objective of a file management system?

تفاصيل المصدرشرائح الفصل 4a · الشرائح ⁦7–8⁩
المصدر
شرائح الفصل 4a · الشرائح ⁦7–8⁩
ملاحظات حول المصدر (1)
  • التقسيم وصف لرسم الشريحة 8؛ في الرسم يتداخل النطاقان عند «السجلات»، ووُضعت هنا مع اهتمامات إدارة الملفات.

File organisationتنظيم الملفات

File organisation
The logical structure of records, determined by the way in which files are accessed.

Criteria (slide 11)

  • Short access time
  • Ease of update
  • Economy of storage
  • Simple maintenance
  • Reliability
  • Priority will differ depending on the use (e.g., read-only CD vs hard drive); some criteria may even conflict.

Types (slide 12) — usually variations of

  • Pile
  • Sequential file
  • Indexed sequential file
  • Indexed file
  • Direct, or hashed, file

Which of these is a file organisation type?

تفاصيل المصدرشرائح الفصل 4a · الشرائح ⁦10–12⁩
المصدر
شرائح الفصل 4a · الشرائح ⁦10–12⁩

Directory contents and elementsعناصر الدليل

File directories: contents and elements

  • A directory contains information about files (attributes, location, ownership).
  • The directory itself is a file owned by the operating system.
  • It provides the mapping between file names and the files themselves.
Directory elements (slides 15–17)
GroupالمجموعةElements (slides 15–17)العناصر
Basic information
  • File name (unique within a specific directory)
  • file type
  • file organisation
Address information
  • Volume (device on which the file is stored)
  • starting address
  • size used (current size)
  • size allocated (maximum size)
Usage information
  • Date created
  • identity of creator
  • date last read access
  • identity of last reader
  • date last modified
  • identity of last modifier
  • date of last backup
  • current usage (current activity, locks)

In which group of directory elements is the "date of last backup"?

تفاصيل المصدرشرائح الفصل 4a · الشرائح ⁦14–17⁩
المصدر
شرائح الفصل 4a · الشرائح ⁦14–17⁩

Directory structuresهياكل الأدلة

Simple listقائمة بسيطة

  • A list of entries, one for each file (sequential file, name as key)
  • No help in organizing the files
  • User must avoid using the same name for two files

Two-levelمستويان

  • One directory for each user and a master directory
  • Master holds an entry per user (address and access control information)
  • Does not provide structure for collections of files

Hierarchical (tree)هرمي (شجري)

  • Master directory with user directories underneath
  • Each user directory may have subdirectories and files
  • Find a file by following the directory path

Directory operations (slide 19)

  • Search
  • Create files
  • Deleting files
  • Listing directory
  • Updating directory
  • In a tree, duplicate filenames are possible if they have different pathnames (slide 22).

Two users both have a file called report.txt. Which directory structure allows this without conflict?

تفاصيل المصدرشرائح الفصل 4a · الشرائح ⁦18–22⁩
المصدر
شرائح الفصل 4a · الشرائح ⁦18–22⁩

Access rightsحقوق الوصول

  • File sharing has two issues: access rights and management of simultaneous access.
  • Access rights are often a hierarchy where one right implies the previous ones.
Access rights (slides 26–28)
RightالحقThe user can…يستطيع المستخدم…
NoneMay not even know of the file's existence
KnowledgeOnly determine that the file exists and who its owner is
ExecutionLoad and execute a program but cannot copy it
ReadingRead the file for any purpose, including copying and execution
AppendingAdd data to the file but cannot modify or delete any of its contents
UpdatingModify, delete, and add to the file's data
Changing protectionChange access rights granted to other users
DeletionDelete the file

A user may add data to a log file but may not modify or delete anything already in it. Which access right is this?

تفاصيل المصدرشرائح الفصل 4a · الشرائح ⁦25–28⁩
المصدر
شرائح الفصل 4a · الشرائح ⁦25–28⁩

User classes and simultaneous accessفئات المستخدمين

File sharing: access rights and user classes

Ownerالمالك
Usually the file's creator; usually has full rights.
Specific usersمستخدمون محددون
Rights may be explicitly granted to specific users.
User groupsمجموعات
A set of users identified as a group.
Allالجميع
Everyone.

Simultaneous access (slide 30)

  • Lock the entire file when it is to be updated, or lock individual records during the update.
  • Mutual exclusion and deadlock are issues for shared access.
تفاصيل المصدرشرائح الفصل 4a · الشرائح ⁦29–30⁩
المصدر
شرائح الفصل 4a · الشرائح ⁦29–30⁩

Record blockingتكتيل السجلات

  • Records are the logical unit of access; blocks are the unit for I/O with secondary storage.
Fixed blockingالتكتيل الثابت
Fixed-length records; an integral number of records are stored in a block; unused space at the end of a block is internal fragmentation.
Variable-length spanned blockingالمتغير الممتد
Records are packed into blocks with no unused space; some records may span multiple blocks, continued by a pointer to the successor block.
Variable-length unspanned blockingالمتغير غير الممتد
No spanning; wasted space in most blocks because the remainder of a block cannot be used if the next record is larger than the remaining unused space.

المسألة

Illustrative numbers (not from the slides): fixed blocking with 2,048-byte blocks and 300-byte records.

Fixed blocking with 4,096-byte blocks and 500-byte fixed-length records. How many records fit in a block, and how much space is internal fragmentation?

تفاصيل المصدرشرائح الفصل 4a · الشرائح ⁦32, 33, 35, 37⁩
المصدر
شرائح الفصل 4a · الشرائح ⁦32, 33, 35, 37⁩

Allocating space to filesتخصيص المساحة

Secondary storage management: preallocation and portions

  • The operating system is responsible for allocating blocks to files, and must keep track of the space available.

File allocation issues (slide 41)

  • 1. When a file is created, is the maximum space allocated at once?
  • 2. Space is added in contiguous portions — what size should a portion be?
  • 3. What data structure should be used to keep track of the file portions?
Preallocation
Needs the maximum size for the file at the time of creation; it is difficult to reliably estimate, so sizes tend to be overestimated so as not to run out of space.
Portion size
Two extremes: a portion large enough to hold the entire file, or one block at a time — a trade-off between single-file efficiency and overall system efficiency.

What is the main difficulty of preallocation?

تفاصيل المصدرشرائح الفصل 4a · الشرائح ⁦40–44⁩
المصدر
شرائح الفصل 4a · الشرائح ⁦40–44⁩

Contiguous and chained allocationالمتجاور والمتسلسل

Contiguous, chained and indexed allocation

Contiguousمتجاور

  • A single set of blocks is allocated at the time of creation
  • One FAT entry: starting block and length
  • External fragmentation will occur → need to perform compaction

Chainedمتسلسل

  • Allocation on the basis of the individual block
  • Each block contains a pointer to the next block
  • One FAT entry: starting block and length
  • No external fragmentation; best for sequential files

Which allocation method has each block contain a pointer to the next block and is best for sequential files?

تفاصيل المصدرشرائح الفصل 4a · الشرائح ⁦45–50⁩
المصدر
شرائح الفصل 4a · الشرائح ⁦45–50⁩

Indexed allocationالمفهرس

  • The file allocation table contains a separate one-level index for each file.
  • The index has one entry for each portion allocated to the file.
  • The file allocation table contains the block number for the index.
Indexed allocation method (slide 52)

Fixed-size blocks

  • Allocating by blocks eliminates external fragmentation

Variable-sized blocks

  • Improves locality
  • Both cases require occasional consolidation.

من الشرائح

  • Figure 12.11 (slide 53): File B → index block 24, which lists blocks 1, 8, 3, 14, 28.

With indexed allocation, the file allocation table entry for File B contains 24. What is block 24?

تفاصيل المصدرشرائح الفصل 4a · الشرائح ⁦51–54⁩
المصدر
شرائح الفصل 4a · الشرائح ⁦51–54⁩

الخلاصة

تفاصيل المصدر
المصدر
شرائح الفصل 4a

خريطة الفصل

    1. 1مقدمة الفصل
  1. Files and file management systemsالملفات وأنظمة إدارة الملفات

    1. 2Files and file management systemsالملفات ونظام إدارتها
    2. 3Objectives and elements of file managementأهداف إدارة الملفات
  2. File organisation: criteria and typesتنظيم الملفات: المعايير والأنواع

    1. 4File organisationتنظيم الملفات
  3. File directories: contents and elementsالأدلة: محتواها وعناصرها

    1. 5Directory contents and elementsعناصر الدليل
  4. Directory structures and namingهياكل الأدلة والتسمية

    1. 6Directory structuresهياكل الأدلة
  5. File sharing: access rights and user classesمشاركة الملفات: حقوق الوصول وفئات المستخدمين

    1. 7Access rightsحقوق الوصول
    2. 8User classes and simultaneous accessفئات المستخدمين
    1. 9Record blockingتكتيل السجلات
  6. Secondary storage management: preallocation and portionsإدارة التخزين الثانوي: التخصيص المسبق والأجزاء

    1. 10Allocating space to filesتخصيص المساحة
  7. Contiguous, chained and indexed allocationالتخصيص المتجاور والمتسلسل والمفهرس

    1. 11Contiguous and chained allocationالمتجاور والمتسلسل
    2. 12Indexed allocationالمفهرس
    1. 13الخلاصة