3. Topic 3(COLON) Software and Operating Systems

Lesson 3.3: File Systems And Resource Management

Official syllabus section covering Lesson 3.3: File Systems and Resource Management within Topic 3: Software and Operating Systems: How files and folders are organised, named and located by a file system.; File types, extensions and metadata, and how access permissions protect files..

Lesson 3.3: File Systems and Resource Management

Introduction

In this lesson, we will explore how file systems organize and manage files and folders. We will learn how files are named, located, and protected. Our goals are to understand file types and extensions, how metadata works, and the importance of access permissions. Additionally, we will delve into managing storage through fragmentation, compression, and backup strategies. Finally, we will cover how operating systems schedule tasks and share CPU time among applications. By the end of this lesson, students will have a thorough understanding of file systems and resource management in computers.

Understanding File Systems

A file system is a method and data structure that an operating system uses to manage files on a disk or storage device. It provides a way to store, retrieve, and organize files effectively. Here are some key concepts:

1. Organization of Files and Folders

Files and folders in a file system are organized hierarchically in a structure known as a directory tree. The root directory is at the top, and it branches out into various subdirectories and files.

Example

Consider a file system structure as follows:

C:\  
   ├── Documents  
   │   ├── Project  
   │   │   └── project_report.docx  
   │   └── Resume.docx  
   ├── Downloads  
   │   └── software_installer.exe  
   └── Photos  
       ├── vacation.jpg  
       └── family.png  

In this example, C:\ is the root directory, containing subdirectories such as Documents, Downloads, and Photos. Each of these subdirectories can contain files or further subdirectories.

2. Naming and Locating Files

Every file in a file system has a name and a location. A file's name usually includes its base name and an extension (e.g., document.txt). The extension indicates the file type and helps the operating system understand how to handle it.

File Naming Conventions

  • Legal Characters: Most file systems allow letters, numbers, and some symbols in file names but may restrict certain characters (like / and *).
  • Length: The total length of a file name can vary based on the file system, but it is generally limited to 255 characters.

3. File Types and Extensions

Files on a computer can be classified into different types based on their extensions. Common file types include:

  • .txt: Text files
  • .jpg: Image files
  • .exe: Executable files
  • .pdf: Portable Document Format

These extensions are crucial as they determine which applications can open the files. For instance, an executable file (.exe) cannot be opened with a text editor as it's designed to be run by the operating system.

4. Metadata

Metadata is data that provides information about other data. Each file contains metadata that helps the operating system manage it effectively. Common metadata includes:

  • File size
  • Creation date
  • Last modified date
  • Owner (user permissions)

Example of Metadata

For example, the file example.docx might have the following metadata:

  • Size: 150 KB
  • Created: 2023-06-01 12:00 PM
  • Modified: 2023-06-10 3:30 PM
  • Owner: students

This metadata allows users to sort files by date, identify large files, and manage permissions.

Access Permissions

Access permissions are rules that define who can read, write, or execute a file. These permissions are essential for security and data integrity. Here are some key concepts:

1. Types of Permissions

Access permissions typically include three types:

  • Read (R): Permission to view the file
  • Write (W): Permission to modify the file
  • Execute (E): Permission to run the file if it’s an executable

2. User Roles

Permissions can vary based on the user role. Common roles are:

  • Owner: The user who created the file
  • Group: Users who are part of a specific group
  • Public: All users who have access to the system

3. Example of File Permissions

On a Unix-based system, file permissions are often displayed as follows:

-rwxr-xr--  1 user group 1234 Jun 10 12:00 example.txt

Here, the first three characters rwx indicate that the owner has read, write, and execute permissions. The next r-x shows that the group has read and execute permissions but cannot write. Lastly, r-- means that public users can only read the file.

Managing Storage

Storage management is crucial for maintaining a file system's efficiency and performance. Here we discuss fragmentation, compression, and backup.

1. Fragmentation

Fragmentation occurs when files are stored non-contiguously on the storage medium. For example, if a file is stored in multiple pieces scattered across the disk, it leads to wasted space and slower access times.

Example

If you save a large image and the disk space is fragmented, the file might be split like this:

  • Part 1: Blocks 1-5
  • Part 2: Blocks 10-15
  • Part 3: Blocks 20-25

This can slow down file retrieval as the hard drive head has to move to different parts of the disk to access the complete file.

2. Compression

Compression reduces the size of files to save storage space and improve transmission speed. There are two main types of compression:

  • Lossless Compression: Data can be restored to its original state (e.g., .zip files)
  • Lossy Compression: Some quality is sacrificed for size reduction (e.g., .jpg files)

3. Backup Strategies

Backing up data is vital for avoiding loss due to hardware failure or accidental deletion. Common backup strategies include:

  • Full Backup: A complete copy of all data
  • Incremental Backup: Only new or modified files since the last backup
  • Differential Backup: All changes made since the last full backup

Operating System Scheduling and Resource Management

Operating systems manage hardware resources, ensuring efficient operation. Scheduling refers to how the CPU allocates time to various processes:

1. Multitasking

Multitasking allows multiple processes to run simultaneously on a machine. The operating system divides CPU time among active processes, giving the appearance that tasks are running concurrently.

Example

In a scenario where students is listening to music while browsing the web:

  • The audio player continuously plays music by using CPU resources at regular intervals.
  • The web browser retrieves data from the internet and displays webpages, requiring CPU time as well.

2. Scheduling Algorithms

Operating systems use different algorithms to schedule tasks effectively. Some common ones are:

  • First-Come, First-Served (FCFS): Processes are managed in the order they arrive.
  • Round-Robin: Each process receives a time slice, cycling through processes to share CPU resources evenly.
  • Priority Scheduling: Processes with higher priority are allocated CPU time first.

Conclusion

In this lesson, we explored file systems and resource management comprehensively. From organizing files and understanding metadata to learning about access permissions and storage management techniques, students now has a solid foundation in understanding how operating systems manage files and resources. As technology continues to evolve, knowing how these systems work is essential to ensure effective use and management of computer resources.

Study Notes

  • A file system organizes files and folders hierarchically in a directory tree.
  • File names usually consist of a base name and an extension that indicates the file type.
  • Metadata includes essential information about files, like size, creation date, and permissions.
  • Access permissions control who can read, write, or execute a file.
  • Fragmentation can slow down file access and management requires attention to compressing, backing up, and reducing fragmentation for efficiency.
  • Operating systems manage CPU time among tasks, enabling multitasking through scheduling algorithms.

Practice Quiz

5 questions to test your understanding