1 / 45

Topic : File Management

Topic : File Management. Lecture By : Rupinder Kaur Lect IT,SRSGPCG Ludhiana. Index. Definition of OS File and related terms Purpose of File Management Operations on File File Allocation Methods File Organization. Operating System.

kawena
Download Presentation

Topic : File Management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Topic : File Management Lecture By : Rupinder Kaur Lect IT,SRSGPCG Ludhiana

  2. Index • Definition of OS • File and related terms • Purpose of File Management • Operations on File • File Allocation Methods • File Organization

  3. Operating System • An operating system is software, consisting of programs and data, that runs on computers, manages computer hardware resources, and provides common services for execution of various application software. • A program that acts as an intermediary between a user of a computer and the computer hardware.

  4. Functions of OS • Process Management • Memory Management • I/O Management • Secondary Storage Management • File Management

  5. What is File • A file is a collection of related information defined by its creator. • Files represent programs (both source and object forms) and data.

  6. Naming Convention The absolute file name consists of: • drive name • directory name(s) • file name • Extension For example : d:/network/LAN.doc

  7. Information structure of a file • the file’s type (plain file, directory, etc), • the file’s size, in bytes and/or blocks, • any limits set on the file’s size, • the primary owner of the file, • information about other potential users of this file, • access constraints on the owner and other users, • dates and times of creation, last access and last modification, • dates and times of last backup and recovery, and • event triggers when the file changes

  8. Terms Used with Files • Field • Basic element of data • Contains a single value • Characterized by its length and data type • Record • Collection of related fields • Treated as a unit • Example: employee record

  9. Terms Used with Files • File • Collection of similar records • Treated as a single entity • Have file names • May restrict access • Database • Collection of related data • Relationships exist among elements

  10. File Management • The operating system is responsible for the following activities in connections with file management: • File creation and deletion. • Directory creation and deletion. • Support for manipulating files and directories. • Mapping files onto secondary storage. • File backup on stable (nonvolatile) storage media.

  11. File Management • Identify and locate a selected file • Use a directory to describe the location of all files plus their attributes • On a shared system describe user access control • Blocking for access to files • Allocate files to free blocks • Manage free storage for available blocks.

  12. Purpose of File Management The file manager handles all files on secondary storage media. To perform these tasks, file management must: • be able to identify the numerous files by giving unique names to them • maintain a list telling where exactly each file is stored, how many sectors on the medium it occupies, and in which order those sectors make up the file

  13. Purpose of File Management • provide simple and fast algorithms to read and write files • give and deny access rights on files to users and programs • allocate and deallocate files to processes • provide users and programs with simple commands for file handling

  14. Minimal Set of Requirements • Each user should be able to create, delete, read, write and modify files • Each user may have controlled access to other users’ files • Each user may control what type of accesses are allowed to the users’ files • Each user should be able to restructure the user’s files

  15. Minimal Set of Requirements • Each user should be able to move data between files • Each user should be able to back up and recover the user’s files in case of damage • Each user should be able to access the user’s files by using symbolic names

  16. File Operations • Create • Delete • Open • Close • Read • Write

  17. Typical Operations • Retrieve_All : Retrieve all the records of a file. This operation will be required for an application that must process all the information in the file at one time. • Retrieve_One : This operation requires the retrieval of just a single record. Interactive, transaction-oriented applications need this operation • Retrieve_Next : This operation requires the retrieval of the record that is “next” in some logical sequence to the most recently received record. for example : filling in forms

  18. Typical Operations • Retrieve_Previous : Similar to retrieve next, but in this case the record that is “previous” to the currently accessed record is retrieved • Insert_One : Insert a new record into the file. It may be necessary that the new record fit into a particular position to preserve a sequencing of the file. • Delete_One : delete an existing record. Certain linkages or other data structures may need to be updated to preserve the sequencing of the file.

  19. Typical Operations • Update_One : Retrieve a record, update one or more of its fields, and rewrite updated record back into the file. • Retrieve_Few : Retrieve a number of records. For example, an application may wish to retrieve all records that satisfy a certain set of criteria.

  20. Access Rights • None • User may not know of the existence of the file • User is not allowed to read the user directory that includes the file • Knowledge • User can only determine that the file exists and who its owner is

  21. Access Rights • Execution • The user can load and execute a program but cannot copy it • 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

  22. Access Rights • Updating • The user can modify, deleted, and add to the file’s data. This includes creating the file, rewriting it, and removing all or part of the data • Changing protection • User can change access rights granted to other users • Deletion • User can delete the file

  23. Allocation Methods • contiguous file allocation • chained allocation • indexed allocation

  24. Methods of File Allocation Contiguous allocation • Single set of blocks is allocated to a file at the time of creation • Only a single entry in the file allocation table ( Starting block and length of the file ) • External fragmentation will occur • Need to perform compaction

  25. Methods of File Allocation

  26. Methods of File Allocation

  27. Methods of File Allocation Chained allocation • Allocation on basis of individual block • Each block contains a pointer to the next block in the chain • Only single entry in the file allocation table • Starting block and length of file • No external fragmentation • Best for sequential files

  28. Methods of File Allocation

  29. Methods of File Allocation

  30. Methods of File Allocation Indexed allocation • 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 block number for the index

  31. Methods of File Allocation

  32. File Organization File Organization refers to the logical structuring of the records as determined by the way in which they are accessed Criteria for File Organization : • Short access time • Ease of update • Economy of storage • Simple maintenance • Reliability

  33. File Organization Five different types of File Organization available: • The pile • The Sequential file • The Indexed Sequential file • The Indexed file • The Direct or hashed file

  34. File Organization The Pile • Data are collected in the order they arrive • Purpose is to accumulate a mass of data and save it • Records may have different fields • No structure • Record access is by exhaustive search

  35. File Organization

  36. File Organization The Sequential File • Fixed format used for records • Records are the same length • All fields the same (order and length) • Field names and lengths are attributes of the file • One field is the key filed (Primary key)

  37. File Organization The Sequential File • New records are placed in a log file or transaction file • Batch update is performed to merge the log file with the master file.

  38. File Organization • Sequential File • Contains key field and a pointer to the main file • Search continues in the main file at the location indicated by the pointer

  39. File Organization Indexed Sequential File • New records are added to an overflow file • Record in main file that precedes it is updated to contain a pointer to the new record • The overflow is merged with the main file • Multiple indexes for the same key field can be set up to increase efficiency

  40. File Organization

  41. File Organization Indexed File • Uses multiple indexes for different key fields • May contain an exhaustive index that contains one entry for every record in the main file • May contain a partial index

  42. File Organization

  43. File Organization The Direct or Hashed File • Directly access a block at a known address • Key field required for each record

  44. File Sharing • In multiuser system, allow files to be shared among users • Two issues • Access rights • Management of simultaneous access

  45. Thanks

More Related