Skip to main content

Concept of file management (OS)

5.1 Introduction to file management

File management is a critical function of an operating system (OS) that allows users to store, retrieve, organize, and manipulate files efficiently. It ensures efficient handling of files, enabling the creation, reading, updating, and deletion of files.

A file management system has limited capabilities and is designed to manage individual or group files, such as special office documents and records. It may display report details, like owner, creation date, state of completion and similar features useful in an office environment. A file management system is also known as a file manager.

5.2 File naming, file operations, file extension and file system layout

File Naming

Descriptive file names are an important part of organizing, sharing, and keeping track of data files. Develop a naming convention based on elements that are important to the project.

File naming best practices:

        Files should be named consistently

        File names should be short but descriptive (<25 characters)

        Avoid special characters or spaces in a file name

        Use capitals and underscores instead of periods or spaces or slashes

        Use date format ISO 8601: YYYYMMDD

 

The most basic operations that programs can perform on a file are:

        Create a new file.

        Change the access permissions and attributes of a file.

        Open a file, which makes the file contents available to the program.

        Read data from a file.

        Write data to a file.

        Delete a file.

File Extension

A file extension, or filename extension, is a suffix at the end of a computer file. It comes after the period and is usually two to four characters long. If you’ve ever opened a document or viewed a picture, you’ve probably noticed these letters at the end of your file.

File extensions are used by the operating system to identify what apps are associated with what file types. For example, a file named “sankalpa.jpg” has the “jpg” file extension. When you open that file in Windows, for example, the operating system looks for whatever app is associated with JPG files, opens that app, and loads the file.


File System Layout

A file system is a structured collection of files, directories, and related data that organizes how information is stored and retrieved on a disk. It keeps track of where each file is located and manages storage efficiently. A file system includes components such as a boot block, superblock, allocation bitmaps, and allocation groups, all of which work together to manage disk storage.

Boot Block

The boot block is the first part of the file system, located at the beginning of the disk. It contains the information required to start or boot the operating system.

Superblock

The superblock stores important metadata about the entire file system. It includes details such as the size of the file system, number of data blocks, state of the system, and allocation group sizes.

Allocation Bitmaps

Allocation bitmaps are used to keep track of used and free disk space. One bitmap records the status of disk blocks (fragments), while another tracks the allocation of i-nodes.

Disk Allocation (File Allocation)

Disk allocation refers to the method used by an operating system to store files on disk blocks. Its main goals are efficient space utilization and fast file access.

1. Contiguous Allocation

In contiguous allocation, a file is stored in consecutive disk blocks starting from a specific location. This method allows fast access because blocks are sequential. However, it suffers from fragmentation and makes it difficult to expand files when space is not available continuously.

2. Linked Allocation

In linked allocation, file blocks are stored at random locations on the disk and connected using pointers. This method eliminates external fragmentation and allows easy file growth. However, it is slower because accessing data requires following pointers, and it does not support direct access efficiently.

3. Indexed Allocation

In indexed allocation, each file has a separate index block that stores pointers to all its disk blocks. This method supports direct access and avoids fragmentation. However, it introduces overhead due to the extra index block and may waste space for small files.

Free Space Management

Free space management is the process of tracking and managing unused disk blocks so they can be allocated to new files. When a file is deleted, its space is returned to the free space list for reuse.

1. Bitmap Method

In the bitmap method, each disk block is represented by a bit. A value of 1 indicates a free block, while 0 indicates an allocated block. This method is simple and efficient for finding free space but may not be suitable for very large disks.

2. Linked List Method

In this method, all free blocks are linked together using pointers. The system keeps a pointer to the first free block. Although it is easy to allocate space, searching for free blocks can be slow due to disk access time.

3. Grouping Method

Grouping stores addresses of multiple free blocks together in one block. This improves efficiency by allowing several free block addresses to be accessed at once instead of one at a time.

4. Counting Method

Counting keeps track of contiguous free blocks by storing the starting block address and the number of free blocks. This method is efficient when free space exists in large continuous chunks.


Comments

Popular posts from this blog

Function of OS 1. Process Management The operating system helps in running many programs at the same time. It keeps track of each running program (called a process), decides which one should run next, and stops or starts them as needed. It makes sure that all the programs get a fair chance to use the CPU.   2. Memory Management The OS manages the computer's memory (RAM). It decides which program will use how much memory and keeps track of it. When a program is closed, it frees up the memory so that other programs can use it. This helps the computer run smoothly without crashing.   3. File System Management The operating system helps us to create, save, open, and delete files. It organizes files in folders and keeps them safe. It also controls who can open or edit a file to protect our data.   4. Device Management The OS controls all the input and output devices like the keyboard, mouse, printer, and monitor. It tells the devices what to do and makes su...

UNIT 3 Array in C#

  Array in C# An array is a collection of variables of the same data type , stored in contiguous memory locations , and accessed using a common name and index . Each item in an array is called an element , and the index of arrays in C# starts from 0 .     Key Points About Arrays in C#: 1.       Elements are stored in contiguous memory locations. 2.       Index starts from 0. So, for an array of size 5, valid indexes are 0 to 4. 3.       Arrays are reference types and are allocated on the heap. 4.       C# array is an object of base type System.Array . 5.       Array elements can be of any type , including another array (array of arrays). 6.       Jagged array (array of arrays) elements are reference types and are initialized to null . 7.       Arrays can be single-dimensi...

Unit 5 SEP

  Software analysis and Design tools Software Analysis and Design Tools are special computer programs that help developers and designers in every stage of making software. These tools make it easier to understand, plan, design, and document a software system so that the final product works well and meets user needs. They help in collecting requirements by recording what users want, modeling the system using diagrams such as flowcharts and UML, and designing the structure and interface of the software. These tools also help in creating documentation for clear communication, analyzing the design to find and fix problems early, and supporting teamwork by allowing different people to work together on the same project smoothly. Introduction of ER Model The Entity-Relationship (ER) Model is a conceptual model used to design and represent the logical structure of a database . It shows entities, their attributes, and relationships among them. Example: A Student enr...