1. Trang chủ
  2. » Công Nghệ Thông Tin

Lecture Operating system principles - Chapter 12: File management

42 39 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 42
Dung lượng 259,94 KB

Nội dung

After studying this chapter, you should be able to: Describe the basic concepts of files and file systems, understand the principal techniques for file organization and access, define B-trees, explain file directories, understand the requirements for file sharing.

Chapter 12 File Management • Overview • File organisation and Access • File Directories • File Sharing • Record Blocking Files • Files are the central element to most applications – file as an input to applications – file as an output for long-term storage and for later access • Desirable properties of files: – Long-term existence – Controlled sharing between processes – Structure that is convenient for particular applications File Structure Fields and Records • Fields – Basic element of data • e.g., student’s last name – Contains a single value – Characterized by its length and data type • Records – Collection of related fields • e.g., a student record – Treated as a unit File Structure File and Database • File – Collection of similar records – Treated as a single entity and may be referenced by name – Access control restrictions usually apply at the file level • Database – Collection of related data – Explicit relationships exist among elements – Consists of one or more files A Big Picture How to organize records in a file and access a particular record in a file? How to organize records as a sequence of blocks for I/O? individual block I/O requests must be scheduled for optimizing performance How to identify and locate a selected file? How to enforce user access control in shared systems? Roadmap • Overview • File organisation and Access • File Directories • File Sharing • Record Blocking File Organization • The basic operations that a user or application may perform on a file are performed at the record level – The file is viewed as having some structure that organizes the records • File organization refers to the logical structuring of records – Determined by the way in which files are accessed (access method) Criteria for File Organization • Important criteria include: – Short access time – Ease of update – Economy of storage – Simple maintenance – Reliability Criteria for File Organization • Priority will differ depending on the use – For batch mode file processing, rapid access for retrieval of a single record is of minimal concern • These criteria may conflict – Use of indexes (conflict with economy of storage) can be a primary means of increasing the speed of access to data The Pile • Data are collected in the order they arrive – No structure • Purpose is to accumulate a mass of data and save it • Records may have different fields – field should be self-describing (field name + value) – field length should be known (delimiters, subfield or default for a field type) 10 File Sharing • In multiuser system, there is almost always a requirement for allowing files to be shared among a number of users • Two issues – Access rights – Management of simultaneous access 28 Access Rights • A wide variety of access rights have been used by various systems – often as a hierarchy, with each right implying those that precede it • None – User may not know the existence of file by not allowing to read the user directory that includes this file • Knowledge – User can only determine that the file exists and who its owner is 29 Access Rights cont… • Execution – The user can load and execute a program but cannot copy it, e.g., proprietary programs • Reading – The user can read the file for any purpose, including copying and execution • Appending – The user can add data to the file but cannot modify or delete any of the file’s contents 30 Access Rights cont… • Updating – The user can modify, delete, and add to the file’s data • Changing protection – User can change access rights granted to other users • Deletion – User can delete the file 31 User Classes • Access can be provided to different classes of users – Owner: usually the files creator, has full rights and may grant rights to others – Specific users: individual users who are designated by user ID – User groups: a set of users identified as a group – All: all users who have access to this system 32 Simultaneous Access • When access is granted to append or update a file to more than one user, the OS or file management system must enforce discipline • User may lock the entire file or individual records during update • Mutual exclusion and deadlock are issues for shared access, ref readers/writers problem 33 Roadmap • Overview • File organisation and Access • File Directories • File Sharing • Record Blocking 34 Blocks and records • Records are the logical unit of access of a structured file • Blocks are the unit for I/O with secondary storage • For I/O to be performed, records must be organized as blocks • Three methods of blocking are common – Fixed length blocking – Variable length spanned blocking – Variable-length unspanned blocking 35 Fixed Blocking • Fixed-length records are used, and an integral number of records are stored in a block • Unused space at the end of a block is internal fragmentation • Common for sequential files with fixedlength records 36 Fixed Blocking 37 Variable Length Spanned Blocking • Variable-length records are used and are packed into blocks with no unused space • Some records may span multiple blocks – Continuation is indicated by a pointer to the successor block •  Efficient for storage and does not limit the size of records 38 Variable Blocking: Spanned •  Difficult to implement •  Records that span two blocks require two I/O operations 39 Variable-length unspanned blocking • Uses variable length records without spanning •  Wasted space in most blocks because of the inability to use the remainder of a block if the next record is larger than the remaining unused space •  Limits record size to the size of a block 40 Variable Blocking: Unspanned 41 Revisit the Big Picture User views the file as having some structure that organizes the records; different access methods reflect different file structures Describes the location of all files plus their attributes Records must be organized as a sequence of blocks for output and unblocked after input individual block I/O requests must be scheduled for optimizing performance Only authorized users are allowed to access particular files in particular ways 42 ... systems and inventory control systems 18 Roadmap • Overview • File organisation and Access • File Directories • File Sharing • Record Blocking 19 File Directory • Contains information about files... locate a selected file? How to enforce user access control in shared systems? Roadmap • Overview • File organisation and Access • File Directories • File Sharing • Record Blocking File Organization... main file • requires on average 500 accesses to the index file + 500 accesses to the main file 15 Indexed Sequential File • An overflow file is added • A new record is added to the overflow file

Ngày đăng: 30/01/2020, 05:07