61
Chapter 8 File Management

PPT_ch08

  • Upload
    brad

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

  • Chapter 8 File Management

    Understanding Operating Systems, Sixth Edition

  • After completing this chapter, you should be able to describe:The fundamentals of file management and the structure of the file management systemFile-naming conventions, including the role of extensionsThe difference between fixed-length and variable-length record formatUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • The advantages and disadvantages of contiguous, noncontiguous, and indexed file storage techniquesComparisons of sequential and direct file accessAccess control techniques and how they compareThe role of data compression in file storageUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • File management systemSoftware File access responsibilitiesCreating, deleting, modifying, controllingSupport for libraries of programsOnline usersSpooling operationsInteractive computingCollaborates with device managerUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Four tasksFile storage trackingPolicy implementationDetermine where and how files are storedEfficiently use available storage spaceProvide efficient file accessFile allocation if user access cleared Record file useFile deallocationFile returned to storageCommunicate file availabilityUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Policy determines:File storage locationSystem and user accessUses device-independent commandsAccess to materialTwo factorsFlexibility of access to information (Factor 1)Shared filesProviding distributed accessAllowing users to browse public directoriesUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Subsequent protection (Factor 2)Prevent system malfunctionsSecurity checksAccount numbers and passwordsFile allocationActivate secondary storage device, load file into memory, update recordsFile deallocationUpdate file tables, rewrite file (if revised), notify waiting processes of file availabilityUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • FieldGroup of related bytesIdentified by user (name, type, size)RecordGroup of related fieldsFileGroup of related recordsInformation used by specific application programsReport generationFlat fileNo connections to other files, no dimensionalityUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • DatabasesGroups of related filesInterconnected at various levelsGive users flexibility of access to stored dataProgram filesContain instructions DirectoriesListings of filenames and their attributesUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • User CommandsOPEN, DELETE, RENAME, COPY

    Device independentPhysical location knowledge not needed Cylinder, surface, sectorDevice medium knowledge not neededTape, magnetic disk, optical disc, flash storageNetwork knowledge not neededUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Logical commandsBroken into lower-level signalsExample: READMove read/write heads to record cylinderWait for rotational delay (sector containing record passes under read/write head)Activate appropriate read/write head and read recordTransfer record to main memorySend flag indicating free device for another requestPerforms error checking and correctionNo need for error-checking code in programsUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • VolumeSecondary storage unit (removable, nonremovable) Multifile volumeContains many filesMultivolume filesExtremely large files spread across several volumesVolume nameFile manager managesEasily accessibleInnermost part of CD, beginning of tape, first sector of outermost trackUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Master file directory (MFD)Stored immediately after volume descriptorListsNames and characteristics of every file in volumeFile names (program files, data files, system files)SubdirectoriesIf supported by file manager Remainder of volumeUsed for file storageUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Single directory per volumeSupported by early operating systemsDisadvantagesLong search time for individual fileDirectory space filled before disk storage space filledUsers cannot create subdirectoriesUsers cannot safeguard their files Each program needs unique nameEven those serving many usersUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • File managersCreate MFD for each volumeContains file and subdirectory entriesImprovement over single directory schemeProblems remain: unable to logically group filesSubdirectoryCreated upon account openingTreated as fileFlagged in MFD as subdirectoryUnique propertiesUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • File managers todayUsers create own subdirectories (folders) Related files grouped together Implemented as upside-down treeEfficient system searching of individual directories May require several directories to reach fileUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • File descriptorFilename: ASCII codeFile type: organization and usageSystem dependentFile size: for convenienceFile locationFirst physical block identification Date and time of creationOwnerProtection information: access restrictionsRecord size: fixed size, maximum sizeUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Filename componentsRelative filename and extensionComplete filename (absolute filename)Includes all path informationRelative filenameName without path informationAppears in directory listings, foldersProvides filename differentiation within directoryVaries in lengthOne to many charactersOperating system specificUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • ExtensionsAppended to relative filenameTwo to three charactersSeparated by periodIdentifies file type or contentsExampleBASIA_TUNE.MP3Unknown extensionRequires user intervention

    Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Operating system specificsWindowsDrive label and directory name, relative name, and extensionUNIX/LinuxForward slash (root), first subdirectory, sub-subdirectory, files relative nameUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Arrangement of records within filesAll files composed of recordsModify commandRequest to access record within a file

    Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Fixed-length recordsDirect access: easyRecord size criticalIdeal for data filesVariable-length recordsDirect access: difficult No empty storage space and no character truncationFile descriptor stores record formatUsed with files accessed sequentiallyText files, program filesUsed with files using index to access recordsUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Describes:Record arrangement Medium characteristicsMagnetic disks file organizationSequential, direct, indexed sequentialFile organization scheme selection considerations Volatility of dataActivity of fileSize of fileResponse timeUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Sequential record organizationRecords stored and retrieved seriallyOne after the otherEasiest to implement File search: beginning until record foundOptimization features may be built into system Select key field from record and sort before storageComplicates maintenance algorithms Preserve original order when records added, deletedUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Direct record organizationUses direct access filesDirect access storage device implementationRandom organizationRandom access filesRelative address record identificationKnown as logical addressesComputed when records stored, retrievedUses hashing algorithms to transform a key fieldUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Direct record organization (cont'd.)AdvantagesFast record access Sequential access if starting at first relative address and incrementing to next recordUpdated more quickly than sequential filesNo preservation of records order Adding, deleting records is quickDisadvantages Hashing algorithm collisionSimilar keysUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Indexed sequential record organizationBest of sequential and direct accessISAM software: creates, maintainsAdvantage: no collisions (no hashing algorithm)Generates index file for record retrievalDivides ordered sequential file into equal sized blocks Each entry in index file contains the highest record key and physical data block locationSearch index fileOverflow areasUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • File manager works with filesAs whole unitsAs logical units or recordsWithin fileRecords must have same formatRecord length may varyRecords subdivided into fieldsApplication programs manage record structure File storageRefers to record storageUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Records stored one after anotherAdvantages Any record found once starting address, size knownEasy direct accessDisadvantagesDifficult file expansion, fragmentationUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Files use any available disk storage spaceFile records stored in contiguous mannerIf enough empty spaceRemaining file records and additions Stored in other disk sections (extents)ExtentsLinked together with pointersPhysical size determined by operating systemUsually 256 bytes

    Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • File extents linked in two waysStorage levelEach extent points to next one in sequenceDirectory entryFilename, storage location of first extent, location of last extent, total number of extents (not counting first)Directory levelEach extent listed with physical address, size, pointer to next extentNull pointer indicates last oneUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • AdvantageEliminates external storage fragmentationEliminates need for compactionDisadvantageNo direct access supportCannot determine specific records exact locationUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Allows direct record accessBrings pointers together Links every extent file into index blockEvery file has own index block Disk sector addresses for fileLists entry in order sectors linkedSupports sequential and direct accessDoes not necessarily improve storage space useLarger files experience several index levelsUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Dictated by a file organizationMost flexibility: indexed sequential filesLeast flexible: sequential filesSequential file organizationSupports only sequential accessRecords: fixed or variable lengthAccess next sequential recordUse address of last byte readCurrent byte address (CBA)Updated every time record accessedUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Update CBAFixed-length recordsIncrement CBCBA = CBA + RLVariable-length recordsAdd length of record (RL) plus numbers of bytes used to hold record to CBACBA = CBA + N + RLUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Fixed-length records (RN: desired record number)CBA = (RN 1) * RLVariable-length recordsVirtually impossibleAddress of desired record cannot be easily computedRequires sequential search through recordsKeep table of record numbers and CBAsIndexed sequential fileAccessed sequentially or directlyIndex file searched for pointer to data blockUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Level implementationStructured and modular programming techniquesHierarchicalHighest module passes information to lower moduleModules further subdividedMore specific tasksUses information of basic file systemLogical file system transforms record number to byte addressUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Verification at every levelDirectory levelFile system checks if requested file existsAccess control verification moduleDetermines whether access allowedLogical file systemChecks if requested byte address within file limitsDevice interface moduleChecks if storage device existsUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • File sharingData files, user-owned program files, system filesAdvantagesSave space, synchronized updates, resource efficiencyDisadvantageNeed to protect file integrityFive possible file actionsREAD only, WRITE only, EXECUTE only, DELETE only, combinationFour methodsUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • AdvantagesEasy to implementWorks well in system with few files, users Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • DisadvantagesAs files and user increase, matrix increasesPossibly beyond main memory capacityWasted space: due to null entriesUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Modification of access control matrix technique

    Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Contains user names granted file accessUser denied access grouped under WORLDShorten list by categorizing users SYSTEMPersonnel with unlimited access to all filesOWNERAbsolute control over all files created in own accountGROUPAll users belonging to appropriate group have accessWORLDAll other users in systemUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Lists every user and files each has access toCan control access to devices as well as to filesMost commonUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • A technique used to save space in files Text decompressionOther decompression schemes

    Understanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Records with repeated charactersRepeated characters are replaced with a codeRepeated termsCompressed using symbols to represent most commonly used wordsUniversity student database common wordsStudent, course, grade, department each be represented with single characterFront-end compressionEntry takes given number of characters from previous entry that they have in commonUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • Large filesVideo and musicISO MPEG standardsPhotographsISOInternational Organization for StandardizationUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

  • File managerControls every file and processes user commandsManages access control proceduresMaintain file integrity and securityFile organizationsSequential, direct, indexed sequentialPhysical storage allocation schemesContiguous, noncontiguous, indexed Record typesFixed-length versus variable-length recordsFour access methodsUnderstanding Operating Systems, Sixth Edition*

    Understanding Operating Systems, Sixth Edition

    **