File management
CIE A-Level Computer ScienceΒ· Unit 5: System softwareΒ· 15 min read
1. Core Purpose of File Managementβ β ββββ± 10 min
File Management
The component of an operating system that manages how files and data are stored, organised, accessed, and secured on secondary storage devices.
Example:
Handles creating, deleting, modifying, and reading files on a hard disk drive or SSD.
File management abstracts physical storage details from users and applications, providing a logical view of data rather than requiring programs to interact directly with hardware sectors. It also provides security via access control and ensures efficient use of available storage space.
List three key services that a file management system provides to end users.
- 1
- Organisation and naming: Allows users to assign custom names to files and group related files into folders/directories.
- 2
- Access security: Provides permission systems to restrict who can read, modify, or execute specific files.
- 3
- Hardware abstraction: Hides the physical location of file data from the user, eliminating the need for users to manage disk sectors directly.
Exam tip:
Always link file management services to both user needs and operating system efficiency when answering 4+ mark questions.
2. File Allocation Methodsβ β β βββ± 15 min
β Calculator OK
File Allocation
The process of assigning physical storage clusters on a disk to logical files.
Contiguous allocation: All file blocks are stored in a single continuous range of disk clusters
Linked allocation: Each file block contains a pointer to the next block, which can be stored anywhere on disk
Indexed allocation: A special dedicated index block stores all pointers to the file's individual data blocks
A 5,242,900 byte file is stored on a disk with 1KB (1024 byte) clusters. Calculate the number of clusters required and the size of internal fragmentation for this file.
- 1
Step 1: Calculate the number of clusters by dividing file size by cluster size, rounding up to the nearest whole number:
- 2ext{Number of clusters} = ext{ceil} rac{5242900}{1024} = 5121
- 3
Step 2: Calculate total allocated space:
- 4
- 5
Step 3: Calculate internal fragmentation as allocated space minus actual file size:
- 6
3. Fragmentation and Defragmentationβ β β βββ± 12 min
Fragmentation occurs when storage space is used inefficiently, leading to slower access times or reduced available capacity. There are two core types:
Internal fragmentation: Unused space within an allocated cluster (when a file is smaller than the cluster size)
External fragmentation: Free space is split into many small non-contiguous blocks, so no single block is large enough for a new file even if total free space is sufficient
Defragmentation
A maintenance process that rearranges file blocks and free space into contiguous blocks to reduce access time and eliminate external fragmentation.
Explain why fragmentation is much less impactful on SSDs than on HDDs.
- 1
- HDDs have moving read/write heads that require extra seek time to access non-contiguous blocks, so fragmentation significantly slows access speeds.
- 2
- SSDs have no moving parts, and can access any memory address in roughly the same amount of time, so seek time does not increase for non-contiguous blocks.
- 3
- Defragmentation also causes extra write cycles that shorten the lifespan of an SSD, so it is not recommended for solid state storage.
4. Directories and Access Permissionsβ β ββββ± 10 min
Modern file systems use hierarchical tree-structured directories to organise files, allowing users to group related files and navigate storage easily. Access permissions control what actions different user groups can perform on a file or directory, a core security feature.
Read (r): Allows opening and reading the content of a file or listing files in a directory
Write (w): Allows modifying, renaming, or deleting a file or adding files to a directory
Execute (x): Allows running the file as an executable program or script
A university file server stores student coursework prior to marking. What permissions should be assigned to a student's assignment file for the student (owner), other students (group), and the general public?
- 1
- Owner (student): Needs to edit the file before submission, so assign read + write permissions (no execute needed for a document file).
- 2
- Other students: To prevent plagiarism, other students should not be able to access the file, so assign no permissions.
- 3
- General public: Same as other students, no permissions are granted to prevent unauthorised access before marking.
5. Common Pitfalls
Wrong move:
Confusing internal and external fragmentation
Why:
Many students mix up the two types, mixing up where the unused space occurs
Correct move:
Remember: internal fragmentation is unused space inside an allocated cluster, external fragmentation is unused free space split into small blocks between allocated files
Wrong move:
Claiming defragmentation fixes internal fragmentation
Why:
Defragmentation only rearranges where allocated blocks are stored, it cannot change how much space is allocated to each cluster
Correct move:
Internal fragmentation is only reduced by using smaller cluster sizes, not defragmentation. Defragmentation only fixes external fragmentation
Wrong move:
Stating contiguous allocation is always better than other allocation methods
Why:
Contiguous allocation has fast read speeds but major drawbacks that are often missed in answers
Correct move:
Acknowledge trade-offs: contiguous allocation has faster access but causes external fragmentation and makes it hard to expand existing files
Wrong move:
Thinking execute permission is required to read a file
Why:
Students often assume all files need execute permission to be accessed
Correct move:
Each permission is for a separate action: read permission controls access to file content, execute permission only controls running program files
6. Quick Reference Cheatsheet
Allocation Method | Key Pros | Key Cons | Fragmentation Caused |
|---|---|---|---|
Contiguous | Fast random access, simple implementation | Causes external fragmentation, hard to expand files | External + internal |
Linked | No external fragmentation, easy to expand files | No direct random access, extra space for pointers | Internal only |
Indexed | Supports direct random access, no external fragmentation | Extra overhead for index blocks, wastes space for small files | Internal only |
When this came up on past exams
AI-estimated based on syllabus patterns β cross-check with official past papers for accuracy. Use only as revision-focus signals.
- 2022 Β· 2
Compare file allocation methods
- 2023 Β· 2
Explain causes of fragmentation
- 2024 Β· 2
Describe file permission types
Going deeper
What's Next
File management is a core component of system software that connects low-level storage hardware to high-level user applications. Understanding how file allocation and fragmentation work helps you answer both conceptual and calculation-based questions in Paper 2, and provides a foundation for understanding more advanced operating system concepts like virtual memory and disk scheduling. The concepts you learned here also apply to real-world system maintenance, such as choosing cluster sizes for formatting drives and setting correct file permissions for security. Explore the related topics below to build on your knowledge of system software.
