File Organization Sheet

Similar documents
File Organization Sheet

Part 1. Introduction to File Organization

Introduction to OS. File Management. MOS Ch. 4. Mahmoud El-Gayyar. Mahmoud El-Gayyar / Introduction to OS 1

Operating system Dr. Shroouq J.

Data and File Structures Chapter 2. Basic File Processing Operations

Computer Organization

Problem Overhead File containing the path must be read, and then the path must be parsed and followed to find the actual I-node. o Might require many

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Computer Organization

Mass Storage. 2. What are the difference between Primary storage and secondary storage devices? Primary Storage is Devices. Secondary Storage devices

Introduction. CS3026 Operating Systems Lecture 01

Module 5a: Introduction To Memory System (MAIN MEMORY)

File System: Interface and Implmentation

12: Memory Management

Introduction to File Structures

CS399 New Beginnings. Jonathan Walpole

Chapter 14: Mass-Storage Systems

The Host Environment. Module 2.1. Copyright 2006 EMC Corporation. Do not Copy - All Rights Reserved. The Host Environment - 1

File System Interface and Implementation

CS370 Operating Systems

Storing Data: Disks and Files. Storing and Retrieving Data. Why Not Store Everything in Main Memory? Chapter 7

Chapter 12: Mass-Storage Systems. Operating System Concepts 8 th Edition,

Storing and Retrieving Data. Storing Data: Disks and Files. Solution 1: Techniques for making disks faster. Disks. Why Not Store Everything in Tapes?

Preview. Memory Management

What is the typical configuration of a computer sold today? 1-1

Module 13: Secondary-Storage

Chapter 12. File Management

Let!s go back to a course goal... Let!s go back to a course goal... Question? Lecture 22 Introduction to Memory Hierarchies

FILE SYSTEMS. CS124 Operating Systems Winter , Lecture 23

Outlook. File-System Interface Allocation-Methods Free Space Management

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 420, York College. November 21, 2006

Pharmacy college.. Assist.Prof. Dr. Abdullah A. Abdullah

CS720 - Operating Systems

Tape pictures. CSE 30341: Operating Systems Principles

Storing Data: Disks and Files. Storing and Retrieving Data. Why Not Store Everything in Main Memory? Database Management Systems need to:

Operating-System Structures

MEMORY BHARAT SCHOOL OF BANKING- VELLORE

Memory management. Knut Omang Ifi/Oracle 10 Oct, 2012

Typical File Extensions File Structure

User Perspective. Module III: System Perspective. Module III: Topics Covered. Module III Overview of Storage Structures, QP, and TM

Storing and Retrieving Data. Storing Data: Disks and Files. Solution 1: Techniques for making disks faster. Disks. Why Not Store Everything in Tapes?

Introduction to Computer Systems and Operating Systems

File System Management

Chapter 6 Storage Management File-System Interface 11.1

Disks, Memories & Buffer Management

Parts are adapted from Windows 98 by Mark Twain Media, Inc. A Computer System has Hardware and Software

Indexing. Jan Chomicki University at Buffalo. Jan Chomicki () Indexing 1 / 25

EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture)

Disks and Files. Storage Structures Introduction Chapter 8 (3 rd edition) Why Not Store Everything in Main Memory?

Storing Data: Disks and Files

Performance of Various Levels of Storage. Movement between levels of storage hierarchy can be explicit or implicit

Q.1 Explain Computer s Basic Elements

CS 550 Operating Systems Spring Memory Management: Paging

Background. 20: Distributed File Systems. DFS Structure. Naming and Transparency. Naming Structures. Naming Schemes Three Main Approaches

1993 Paper 3 Question 6

CHAPTER 11: IMPLEMENTING FILE SYSTEMS (COMPACT) By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

GUJARAT TECHNOLOGICAL UNIVERSITY MASTER OF COMPUTER APPLICATION SEMESTER: III

Virtual Memory. User memory model so far:! In reality they share the same memory space! Separate Instruction and Data memory!!

Storage Devices for Database Systems

OPERATING SYSTEMS UNIT - 1

Computer-System Organization (cont.)

DATA STRUCTURES USING C

OPERATING SYSTEM. PREPARED BY : DHAVAL R. PATEL Page 1. Q.1 Explain Memory

Overview of Mass Storage Structure

Computer-System Architecture (cont.) Symmetrically Constructed Clusters (cont.) Advantages: 1. Greater computational power by running applications

File. File System Implementation. File Metadata. File System Implementation. Direct Memory Access Cont. Hardware background: Direct Memory Access

File System Interface: Overview. Objective. File Concept UNIT-IV FILE SYSTEMS

OPERATING SYSTEMS CS136

ICS Principles of Operating Systems

CHAPTER 6 Memory. CMPS375 Class Notes Page 1/ 16 by Kuo-pao Yang

File Structures and Indexing

CS6401- Operating System QUESTION BANK UNIT-IV

File Systems Management and Examples

An Overview of the Computer System. Kafui A. Prebbie 24

Memory hierarchy and cache

Another fundamental component of the computer is the main memory.

1. What is the difference between primary storage and secondary storage?

Semiconductor Memory Types Microprocessor Design & Organisation HCA2102

MEMORY. Objectives. L10 Memory

OPERATING SYSTEMS: Lesson 1: Introduction to Operating Systems

Caching Prof. James L. Frankel Harvard University. Version of 5:16 PM 5-Apr-2016 Copyright 2016 James L. Frankel. All rights reserved.

Module 2: Computer-System Structures. Computer-System Architecture

Eastern Mediterranean University School of Computing and Technology CACHE MEMORY. Computer memory is organized into a hierarchy.

Concept of Memory. The memory of computer is broadly categories into two categories:

Chapter 11: Implementing File Systems

CREATED BY M BILAL & Arslan Ahmad Shaad Visit:

What Operating Systems Do An operating system is a program hardware that manages the computer provides a basis for application programs acts as an int

EECS 3221 Operating System Fundamentals

EECS 3221 Operating System Fundamentals

Some popular Operating Systems include Linux Operating System, Windows Operating System, VMS, OS/400, AIX, z/os, etc.

File Systems: Consistency Issues

Unit 2 : Computer and Operating System Structure

I/O SYSTEMS. Sunu Wibirama

Chapter 1: Introduction. Chapter 1: Introduction

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Main Points. File systems. Storage hardware characteristics. File system usage patterns. Useful abstractions on top of physical devices

Question?! Processor comparison!

Secondary storage. CS 537 Lecture 11 Secondary Storage. Disk trends. Another trip down memory lane

CISC 7310X. C11: Mass Storage. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 4/19/2018 CUNY Brooklyn College

Storing Data: Disks and Files

Transcription:

File Organization Sheet 1. What are File Structures? A File Structure is a combination of representations for data in files and of operations for accessing the data. A File Structure allows applications to read, write and modify data, find (search about data). 2. Why Study File Structure Design File Structure Design concerned with data processing from three perspective: Storage of data Organization of data Access to data 3. How Can Secondary Storage Access Time be improved? By improving the File Structure, the representation of the data and the implementation of the operations determine the efficiency of the file structure for particular applications. 4. Compare between Data Structure and file structure? Both involve: Representation of Data and Operations for accessing data Difference: 1. Data Structures deal with data in main memory 2. File Structures deal with data in secondary storage device (File). 1 P a g e w i t h o u r b e s t w i s h e s D r. A y m a n

5. What are File Structure Design general goals? Get the information from the disk in one access. If that s not possible, get the information in a few accesses as possible. 6. Prepare a table giving comparative information as to Capacities, Speeds of Access and Costs ($/Mbyte) for the storage devices in the hierarchy. 1. Primary Memory Capacity: 128 MB - 256 MB Access time: 5 10-7 sec= 50 ms Price: 0.2 $/MB 2. Disk (hard disk) Capacity: 30 GB - 60 GB Access time: 15 10-3 sec= 15 ms Price: 0.003 $/MB = 3 $/GB 5. CD-ROM Capacity: 650 MB Access time: 75 ms Price: 0.002 $/MB 6. DVD (Digital Video Disk) Capacity: 4.7 GB Access time: 112 ms Price: 0.001 $/MB 7. Explain the memory Hierarchy and compare between main memories and secondary memory? 2 P a g e w i t h o u r b e s t w i s h e s D r. A y m a n

Main Memory - Fast (since electronic) - Small (since expensive) - Volatile (information is lost when power failure occurs) Secondary Storage - Slow (since electronic and mechanical) - Large (since cheap) - Stable, persistent (information is preserved longer) 10. What is a File? A collection of data is placed under permanent or non-volatile storage Examples: anything that you can store in a disk, hard drive, tape, optical media, and any other medium which doesn t lose the information when the power is turned off. 11. Compare between Logical and physical files? Physical file: physically exists on secondary storage; known by the operating system; appears in its file directory 3 P a g e w i t h o u r b e s t w i s h e s D r. A y m a n

Logical file, what your program actually uses, a pipe though which information can be extracted, or sent. Type Physical File Logical File collection of bytes stored on a disk or tape A Channel (like a telephone line) that hides the details of the file s location and physical format to the program 12. What is a Basic File System? A Basic File System (BFS) is the only software that interfaces directly with the I/O devices attached to the system. 13. Why Users and Computers Have a need for Basic File System? To provide a common interface to perform block I/O. To provide a centralized control program to ensure that the devices connected to the system are being allocated and scheduled properly. To provide an error recovery and exception handling for all users. 14. What are the Sources of File System inputs? User Programs Command Language Files Job Control Languages (JCL). 15. What are the basic Functions of the Basic File System? The allocation of all space on the devices Execute all I/O requests The control of the devices themselves. 4 P a g e w i t h o u r b e s t w i s h e s D r. A y m a n

The processing of all the I/O terminations. Notify the user as to whether the I/O request completed correctly or not. 16. Briefly describe the fundamental file processing operations (write code examples)? Opening Files fd = open(filename, flags); That makes the file ready to use by the program. Closing Files Files are usually closed automatically by the operating system. Reading: reads data from the file Read(Source_file, Destination_addr, Size); Write: writes data into the file Write(Destination_file, Source_addr, Size); Seeking: The action of moving directly to a certain position in a file Seek(Source_file, Offset); Create file operation Required Data Device/user name: tells where to place the file when it is created. Filename identifies the file among all the other files in the computer system. File size tell how much room to allocate when it is creating the file File organization needed so that the file system, or more specifically the access methods, can know how to insert and later retrieve the blocks within the file Block size amount of data that will be read or written in every I/O operation. 5 P a g e w i t h o u r b e s t w i s h e s D r. A y m a n

Tasks performed by the file system to create a file? Validate the User s Input Data Check to see if the file already exists Allocate space on the medium for the file: The BFS can tell if enough space exists by comparing the projected file size, from the vantage point of the user, against the device allocation table on the target device. If there is not enough space on the medium, the BFS has no choice but to abort its processing. Insert a pointer to the first block allocated to the file Allocate and initialize I/O buffers and control blocks First, it must allocate space in memory large enough of READ in the largest block in the file. The blocks of memory, which are dedicated to the transferring of the data from memory to and from the peripheral devices, are called I/O buffers. Next, the BFS must allocate and build a table, also known as a file control block, in which the critical information about the file will be saved. Return success or fail status back to the user. Errors: Another file with the same name already exists. The device has no available space to create another new file. The device is, or has become, nonoperational. There was a hardware problem which aborted the processing One or more of the input parameters given to the BFS were wrong. Open File Operation Required Data Device name User name, or account identification 6 P a g e w i t h o u r b e s t w i s h e s D r. A y m a n

Filename The tasks for processing an OPEN file command are: Allocate space for Internal Control Blocks (ICB) Get the correct volumes mounted on the devices Locate the file on the devices Allocate internal memory space for I/O buffers Protect against unauthorized users Maintain a list of the entire open file in the system. Errors: File not found on the specified device and in the specified user account or directory. This could be because of an incorrectly specified filename or device identifier. File already in use by some other user application. Hardware error has occurred from which the BFS could not recover. Extend File Operation The purpose of the EXTEND file function is to allow the user(s) to explicitly increase the size of a file. Required Data Device and directory name where the file is located Name of the file Amount by which the file should be increased in size. The Tasks must be done as follows: Validate the parameters in this request Check to see if there is enough room on this device to increase the size of the file by the requested amount. If space exists, take the space from the medium s general space pool, and mark it in such a way that no other user can take this space. 7 P a g e w i t h o u r b e s t w i s h e s D r. A y m a n

Errors: Add the space to the file in question, and to the internal information kept on the file, so that can be correctly processed at a later date. Return a success or failure status code to the user. Device has no space available in which to extend the file File was not previously Opened, indicating that the user has inadvertently gotten the sequence of I/O processing out of order. Close File Operation The purpose of a CLOSE file function is to allow the user to decrease, stop using the file, Required Data The name of the file to be closed. An indication of which currently open file is to be closed. The Tasks must be done as follows: Write out any I/O buffers that have been modified and are still in main memory but which have not yet been written out to the specified device Write out any updated information about the file that would be useful or required to know in the future in order to process the file correctly. Release any internal memory space dedicated to the processing of that particular file. Return status to the user, indicating success or failure. Errors: The file to be closed was not currently open Any of the errors that can occur on a WRITE operation could occur, since we are writing blocks back into the file A hardware problem could occur that could abort the CLOSE processing. 8 P a g e w i t h o u r b e s t w i s h e s D r. A y m a n

Delete File Operation The function of the DELETE file request is to erase or get rid of a specific file from the system. This occurs when the user no longer needs a particular file and wishes to reuse the file space from some other purpose. Required Data Device and user account name File name The Tasks must be done as follows: Validate the user s input parameters Return all the space on the media taken up by the file to the space pool on the media Remove the file name from the directory where it resides. Return status to the user. Errors: File could not be found, either because of an invalid file or user account name. Other users were currently active on the file A hardware problem was detected. Block Operation A block of data is the unit of data that is transferred to, or from, a device. The amount of data (i.e., size of the block) is definable by the user. The larger the block, the more data that will be transferred in that I/O operation and the greater the performance of the program. This is true but must be taken from the perspective that the memory resources required to hold these blocks of data is not unlimited and should be considered to be a scarce commodity. Write Operation 9 P a g e w i t h o u r b e s t w i s h e s D r. A y m a n

Provide users with the capability of transferring data out of the computer s main memory and onto one of the devices connected to the system. Required Data Number of the block to be written Address of the I/O buffer in many memory that contains the block to be written Size or amount of the block to be written Name of the status field into which the file system will insert the termination status of the I/O request. The Tasks must be done as follows: The WRITE routine must perform the following tasks as part of the job of processing the request: Validate the input parameters Convert the logical block number to a physical device address Check if space exists in the file for this block If space exists, execute the WRITE I/O operation to the device. Reset the buffer-modified flag for that specific I/O buffer, since that block has now been written out to the device. If space does not exist in the file, extend the file. This is called an implicit extend to the Errors: No space available for the operation to complete Hardware unrecoverable error has occurred Mismatch from READ after WRITE validation sequence. Read Operation The function of the READ routine is to transfer a specific block of data from the medium into main memory. The unit of data transfer is the block. Required Data Number of the block to be read into memory 10 P a g e w i t h o u r b e s t w i s h e s D r. A y m a n

Address of the I/O block buffer in main memory into which the block will be read Size or amount of data to be read into main memory The address of a field into which the file system can store the status of the I/O request The Tasks must be done as follows: Validate input parameters Convert the logical block number to a physical block Read the block into an I/O buffer in main memory Return status to the user program Errors: Read error detected by the device Invalid device block number requested Hardware failure detected 1. Write a code for opening a file and reading form all data from the file and then print all file content on the screen, then close the file? 2. Write a code for calculating the size of a specific file? 11 P a g e w i t h o u r b e s t w i s h e s D r. A y m a n

3. How can the files are treated? A file can be treated as o a stream of bytes (as we have seen before) o a collection of records with fields 4. What is meant by field, record, key, give an example? Field: a data value, smallest unit of data with logical meaning Record: A group of fields that forms a logical unit Key: a subset of the fields in a record used to uniquely identify the record Primary Key: A key that uniquely identifies a record. Secondary Key: Other keys that may be used for search 12 P a g e w i t h o u r b e s t w i s h e s D r. A y m a n

5. What are the common methods for organizing fields in files? 13 P a g e w i t h o u r b e s t w i s h e s D r. A y m a n

6. What are the advantage and disadvantages of the different methods that used in field structure? 14 P a g e w i t h o u r b e s t w i s h e s D r. A y m a n