A high-performance command-line program that computes how logical sectors in a RAID array map to the physical disks and stripes that store them.
This project focuses on storage systems, RAID architectures, and efficient large-scale computation.
RAID arrays distribute and replicate data across multiple disks to improve performance, fault tolerance, or both.
This tool takes a RAID configuration and answers millions of queries of the form:
“Where is logical sector X stored in the RAID array?”
For redundancy and parity-based RAID levels, the program also reports the mirror disk or parity disk affected.
The program reads from stdin and writes results to stdout, making it suitable for piping and batch processing.
| RAID Level | Description |
|---|---|
| RAID 0 | Striping (performance) |
| RAID 1 | Mirroring (redundancy) |
| RAID 01 | Mirror of stripes |
| RAID 10 | Stripe of mirrors |
| RAID 4 | Block striping with dedicated parity |
| RAID 5 | Block striping with distributed parity |
The first line contains five values:
T N C S Q
| Symbol | Meaning |
|---|---|
| T | RAID level (0, 1, 01, 10, 4, 5) |
| N | Number of disks |
| C | Chunk size (in sectors) |
| S | Sectors per disk |
| Q | Number of queries |
The next Q lines contain sector numbers to query.
Example:
5 4 1 1000 3
12
25
90
For each queried sector, the program prints:
<disk> <stripe> [mirror/parity disk]
- disk → disk storing the sector
- stripe → stripe index on that disk
- Additional value depending on RAID level:
| RAID | Third Value |
|---|---|
| RAID 1 / 01 / 10 | Disk containing mirrored copy |
| RAID 4 / 5 | Disk containing affected parity |
| RAID 0 | Not printed |
The program is designed for very large inputs:
- Disks: 2 → 16
- Sectors per disk: billions
- Queries: millions
Efficiency requirements:
- O(1) computation per query
- Minimal memory usage
- Streaming I/O friendly
.
├── makefile
├── raid.c
└── README.md
- Linux environment
- GCC
makemake runInput:
0 3 2 10 2
5
12
Output:
1 2
0 4
- RAID data layout algorithms
- Large-scale numeric computation
- Streaming input/output
- Constant-time mapping logic
- Storage system fundamentals
This repository is for educational and learning purposes.