Chapter 5. File and Memory Management

Similar documents
Segmentation with Paging. Review. Segmentation with Page (MULTICS) Segmentation with Page (MULTICS) Segmentation with Page (MULTICS)

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

File System Implementation. Sunu Wibirama

File Management By : Kaushik Vaghani

e-pg Pathshala Subject: Computer Science Paper: Operating Systems Module 35: File Allocation Methods Module No: CS/OS/35 Quadrant 1 e-text

CS6401- Operating System QUESTION BANK UNIT-IV

FILE SYSTEM IMPLEMENTATION. Sunu Wibirama

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.

Preview. Memory Management

UNIT III MEMORY MANAGEMENT

File System Interface and Implementation

File Directories Associated with any file management system and collection of files is a file directories The directory contains information about

Chapter 11: Implementing File-Systems

Directory Structure and File Allocation Methods

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

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

UNIT 4 Device Management

Operating Systems. No. 9 ศร ณย อ นทโกส ม Sarun Intakosum

Memory Allocation. Copyright : University of Illinois CS 241 Staff 1

Chapter 11: Implementing File Systems. Operating System Concepts 8 th Edition,

Preview. COSC350 System Software, Fall

File-System Structure. Allocation Methods. Free-Space Management. Directory Implementation. Efficiency and Performance. Recovery

UNIX File Systems. How UNIX Organizes and Accesses Files on Disk

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

Chapter 9: Virtual-Memory

CS3600 SYSTEMS AND NETWORKS

Chapter 11: File System Implementation. Objectives

Operating System Support

Memory Management. 3. What two registers can be used to provide a simple form of memory protection? Base register Limit Register

CSE 4/521 Introduction to Operating Systems. Lecture 27 (Final Exam Review) Summer 2018

Welcome to this course on Operating System Concepts

Virtual Memory. Virtual Memory. Demand Paging. valid-invalid bit. Virtual Memory Larger than Physical Memory

Principles of Operating Systems

MODULE 4. FILE SYSTEM AND SECONDARY STORAGE

Operating Systems CMPSC 473. File System Implementation April 1, Lecture 19 Instructor: Trent Jaeger

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

ICS Principles of Operating Systems

File System Internals. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

1. a. Show that the four necessary conditions for deadlock indeed hold in this example.

Chapter 7 Memory Management

File System. Preview. File Name. File Structure. File Types. File Structure. Three essential requirements for long term information storage

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

Operating System Concepts

Operating Systems (2INC0) 2017/18

Memory Management (1) Memory Management

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

Memory Management (1) Memory Management. CPU vs. memory. No.8. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

OPERATING SYSTEMS: Lesson 11: Files

Operating Systems Lecture 6: Memory Management II

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

Introduction to Virtual Memory Management

Disks and I/O Hakan Uraz - File Organization 1

CS720 - Operating Systems

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 358

CS4500/5500 Operating Systems File Systems and Implementations

Virtual Memory cont d.; File System Interface. 03/30/2007 CSCI 315 Operating Systems Design 1

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

Objectives and Functions Convenience. William Stallings Computer Organization and Architecture 7 th Edition. Efficiency

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization

Process size is independent of the main memory present in the system.

File System Internals. Jo, Heeseung

UNIT V SECONDARY STORAGE MANAGEMENT

File System Internals. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Chapter 11: Implementing File Systems

CS 143A - Principles of Operating Systems

Chapter 9 Memory Management

File Management. Chapter 12

Chapter 9: Virtual Memory

Typical File Extensions File Structure

File System CS170 Discussion Week 9. *Some slides taken from TextBook Author s Presentation

There is a general need for long-term and shared data storage: Files meet these requirements The file manager or file system within the OS

Chapter 8 Virtual Memory

Virtual Memory. Chapter 8

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

Subject Teacher: Prof. Sheela Bankar

Chapter 8: Virtual Memory. Operating System Concepts

Optimal Algorithm. Replace page that will not be used for longest period of time Used for measuring how well your algorithm performs

Outline. V Computer Systems Organization II (Honors) (Introductory Operating Systems) Advantages of Multi-level Page Tables

File system internals Tanenbaum, Chapter 4. COMP3231 Operating Systems

Module 9: Virtual Memory

Chapter 6 Storage Management File-System Interface 11.1

Fall COMP3511 Review

Chapter 8 & Chapter 9 Main Memory & Virtual Memory

stack Two-dimensional logical addresses Fixed Allocation Binary Page Table

Memory Management. Goals of Memory Management. Mechanism. Policies

OPERATING SYSTEM. Chapter 12: File System Implementation

File System: Interface and Implmentation

I/O Management and Disk Scheduling. Chapter 11

The functionality. Managing more than Operating

Chapter 8. Operating System Support. Yonsei University

FILE SYSTEMS. CS124 Operating Systems Winter , Lecture 23

Chapter 11: Implementing File Systems

1. Background. 2. Demand Paging

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition

Section 10: Device Drivers, FAT, Queuing Theory, Memory Mapped Files

Secondary Storage (Chp. 5.4 disk hardware, Chp. 6 File Systems, Tanenbaum)

Chapter 14: File-System Implementation

Introduction. Secondary Storage. File concept. File attributes

Module 9: Virtual Memory

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

Transcription:

K. K. Wagh Polytechnic, Nashik Department: Information Technology Class: TYIF Sem: 5G System Subject: Operating Name of Staff: Suyog S.Dhoot Chapter 5. File and Memory Management A. Define file and explain its attributes 1. File is collection of related information that stored in secondary storage such as magnetic tape, magnetic disk etc. 2. Each file has attributes which vary from one OS to other OS 3. Characteristics of file known as attribute of file a. Name: Unique name associated with file through which it get called. b. Type: It may be text, executable, multimedia, sound etc. type of file c. Size: Size of file in bits, bytes or records d. Location: Address of file that stored in secondary storage e. Protection: Access control information i.e read only or write only f. Date of creation: Date when file created g. Date of modification: recent changes done with file data. h. User: Name of user who create file i. Last use: Date and time at which last time user access the file j. Usage count: Number of user currently using same file B. Explain different operations performed on file a. File creation 1. New file can be created by user by satisfying following conditions: 2. Space must be available in secondary storage

3. Record of newly created file should be maintained in directory 4. If any of the two conditions fails, then the file will not be created b. File Writing 1.Two things are required for writing to a file: 2.specifying the name of file and information to write 3. The system will first search for the name of file in directory and if file is found then it will be open and information will be writing. c. File Read 1.Two things are required for reading a file. 2.Name of file and memory location to store data 3. The system will first search for the name of file in directory and if file is found then it will be open and information will be reading. Readed information will be stored in memory. d. File Rewind 1. Changing position of pointer within file known as rewinding. 2. By default position of pointer is present at starting location while reading and end location while writing. 3. It does not involve any input / output operations. e. File Delete 1. Removing file from memory only requires name of the file 2. The system will first search for the name of file in directory and if file is found then it will be deleted and space occupied by file will be released C. Explain different types of file 1. Extension indicates which type of file it is and also tells what kind of operation performed on it. 2. Types of file include: A. Regular File: This type of file contains data which include text or binary files B. Text File: This type of file contains actual information stored in ASCII format and readable by user. C. Binary File: This type of file includes commands and programs that are stored in executable binary file. D. Directory File: This type of file does not include any information but it includes file or subdirectory.

E. Special File: This type of file includes devices for the system or temporary files created by process. D. Explain Access methods of file 1. The methods which are used to access files known as access methods 2. It include searching the file on secondary storage 3. It contains following methods to access a. Sequential Access: 1. File organized as collection of fixed length record and each record has fixed number of fields 2. In this type searching of file done one by one 3. It includes only 2 operations i.e. move forward or move backward or rewind to original location 4. To search nth record, (n-1) record need to be scanned 5. Advantage: Useful in tap based system and no data structure required 6. Disadvantage: It is time consuming process and not suitable for large flies.

b. Direct Access: 1. In this file consider as collection of block and block is logical quantity which is of size multiple of 512 bytes. 2. Files are access using blocks without any head movement and head movement require only when head moves from last block to first block 3. It includes Operations like read n, write n, rewind n where n is block number of file 4. Advantage: less time required and accessing speed is fast 5. Disadvantage: It is slow as compared to index file access method E. Explain Swapping 1. Removing suspend or preempted process from memory and bringing back is called swapping 2. Transferring process from memory to disk called as swapping out 3. Transferring process again from disk to memory called as swapping in 4. Swapping used for priority based scheduling algorithm. If higher priority process arrives and want memory then memory manager swap out lower priority process 5. Again lower priority can swap back and its execution get continued 6. Swapping algorithm coordinate amongst information, process and memory management.

F. Explain directory structure of file 1. Organization of files maintained on secondary storage in particular fashion known directory structure 2. It have following types: a. Single Level: 1. Only one directory is available in system 2. All the files of system are available to single directory 3. That directory also called as root directory 4. Advantage: Structure is simple and easy to maintain and understand. Ability to locate files is also simple. 5. Disadvantage: Cannot be used in multiuser system and difficult to remember the name of the files if files are large in quantity. b. Two Level: 1. In this type a directory is maintained for every user in master block. 2. Each user has his own User File Directory i.e. UFD. When user log in to system then system search Master File system. 3. Advantage: Can be used in multi user system and networking. It also provides isolation where data of one user separated from other user. Searching is also efficient as every user has its own directory and files. 4. Disadvantage: Difficult to search files having same names and two users cannot share or communicate with each other if having same file name.

G. Explain different file allocation methods 1. It includes providing space to a file to store on secondary storage 2. It deals with utilizing the space in efficient and effective manner. 3. It includes following allocation methods: A. Contiguous Allocation : 1. It requires each file to occupy a set of contiguous address on the disk. 2. Disk address specifies linear addressing on the disk. 3. If file is n blocks and starting address of starting block is b then file occupies successive blocks b, b+1, b+2.b+(n-1) 4. Directory entry for each file indicates the address of starting block and length i.e. number of blocks allocated to the file 5. Advantage: It supports sequential and direct access. Best allocation for sequential files. To access i th block in a file n blocks long can be access using (n+i) 6. Disadvantage: It is difficult to allocate space to new file. Before allocation of space, size of the file must be predicted. It suffers from external fragmentation.

B. Linked Allocation 1. In this method, each file is a linked list of disk blocks. 2. Blocks are present anywhere on disk. Block is of 512 bytes in size where 2 bytes are reserved to store pointer and 510 bytes are used to store data. 3. Pointer is located to first and last block of file. 4. Advantage: There is no external fragmentation. No need to predict size of file when it is created and any free block from free space list allocate to file. 5. Disadvantage: It does not support direct access method. Memory space is wasted for storing the pointers

C. Indexed Allocation 1. Index block is collection of pointer where directory entry of file maintains the pointer to the index blocks. 2. To read i th block of the file, there is need to access only i th entry of index block 3. Initially all the pointers in the index block are nil. Whenever some information is written in a file then free block is taken from the free space list and its address stored in index block. 4. Advantage: There is no external fragmentation. It supports sequential as well as direct access. There is no need to declare size of file. It is faster than contiguous and linked allocation. 5. Disadvantage: Large amount of space is wasted for small files. Memory space is wasted for maintaining index blocks. H. Explain different file system structure 1. The structure associated with any file is known as file system structure 2. Following are types of file system structure A. Stream of bytes: It does not have any structure to file. File is collection of bytes or stream which not recognizes any file type. B. Records: File is considered as the collection of fixed length records with same internal structure. File is collection of similar records.

C. Tree of records: In this type, file is considered as the collection of variable length records. Each record has its associated key with it. Tree of Record I. Define partitioning and explain different types of it 1. Dividing memory into different sections of same or different size known as partitioning. 2. It is useful for multiprogramming environment. 3. There are two ways to perform partitioning A. Static or Fixed partitioning 1. Starting address of every partition is fixed and it done at time of system generation. 2. It done at time of system generation and then it cannot be changed 3. Initially all partitions are free and when process loaded into memory then status changed from free to allocated 4. Partition Description Table describes status of each partition and its attributes.

5. Following methods are used to allocate a partition to a process: a. Multiple Queue: 1. Depending on number of partition, numbers of queues are maintained. For n partition, n queues are maintained. 2. Each queue maintains size of process and based on size process transferred to queue and then partition. b. Single Queue: 1. Only one queue is maintained and based on size it transferred to partition

6. Advantage: It works fast and partition descriptor table is maintained. Partitions cannot be changed. 7. Disadvantage: Memory wastage in the form of internal fragmentation in which larger partition allocated to the process, the remaining free space cannot be allocated to another process and it will be wasted. B. Variable or Dynamic Partitioning 1. Partitioning is done at the running time of creation of process and then it can be changed 2. Whenever process wants memory then its equal size partition created 3. Starting address of each partition is not fixed 4. Partition Description Table cannot be maintains but bitmap or linked list describe status of each partition 5. Advantage: There is no internal fragmentation. No need to maintained partition descriptor table. It is flexible as compared with static partitioning 6. Disadvantage: No partition descriptor table was maintained. External fragmentation was occurred in which some small partition remains unused.

J. Explain different free space management techniques There are 2 techniques used for free space management: A. Bitmap method 1. In this one bit maintains for very chunk. 2. If chunk of memory is allocated then bitmap associated with that chunk will be 1 and I it is free then it will be 0 3. Memory wastage due to internal fragmentation is minimum. 4. For example, consider a disk where blocks 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 17, 18, 25, 26, and 27 are free, and the rest of the blocks are allocated. The free-space bit map would be: 11000011000000111001111110001111

B. Linked List 1. In this record is created for each partition. 2. Each record maintains the information such as status (Free or Allocated), Starting chunk number, Number of chunks and pointer to next chunk. 3. Record is also called as node. F 0 4. A 4 3 * K. Define Virtual Memory 1. Use of secondary memory as primary memory is known as virtual memory. 2. Virtual memory cab be implemented using paging or segmentation L. Explain Paging in details 1. Address space of the process consist of number of fixed size continuous pages 2. Physical memory divided into number of fixed size page frames. 3. Address of program or page generated by cpu is divided into two parts i.e. page number and offset 4. Page table contains the base address of each page in physical memory. Base address combined with the page offset to define the physical memory address that sent to memory unit.

5. In virtual memory using paging, initially most important pages which are responsible for starting of execution are loaded in memory. 6. When some new page is demanded and if it is not available in memory then page fault occurs. 7. In demand paging, Operating system locate page on disk and brought in memory. 8. If all the physical page frames are fully occupied and if new page need to brought in main memory then some existing page from main memory need to be replace with required page 9. To choose the page for replacement different page replacement policies are used: a. First In First Out: It replaces the page which is brought in the memory first for bringing the new page in the memory. b. Optimal Page Replacement: It replaces the page that will not require immediately. c. Least Recently Used: It replaces a page that has been unused for the longest time. M. Compare Paging and Segmentation Sr. No 01 Definition Point Paging Segmentation Process of dividing memory into fixed size blocks called as page frames All pages are of equal size There is no external fragmentation Page Map Table is used Process of dividing memory into number of smaller blocks called as segments 02 Size All segments are of different size 03 External There is external Fragmentation fragmentation 04 Address Table Segmentation Map Table is used 05 Speed Fast Slow 06 Loading Page allocated to Segment cannot be allocated any free page frame to any free segment