THINK FIRST·CODE LATER

← All labs

RAID planner

Problem

Input: number of disks n, disk size (TB), random IOPS per disk, read fraction; then RAID levels (RAID0, RAID1 as an n-way mirror, RAID5, RAID6, RAID10).

For each level compute usable capacity, failures tolerated (0 disks, n-1 disks, 1 disk, 2 disks, 1 per pair), write penalty (1, n, 4, 6, 2) and effective IOPS = n × IOPS / (read + (1 − read) × penalty).

Print the header level usable tolerates write-penalty effective-IOPS and one line per level with the format %-7s %6.1f TB %-10s %13d %14.0f.

Data for this lab

Your program reads its data from standard input. Download the file, then give it to your program as shown below. Start with data set 1: its expected output is given.

os11-3-data-1.txt

6 4 200 0.7
RAID0 RAID1 RAID5 RAID6 RAID10
What your program must print for os11-3-data-1.txt
level    usable    tolerates  write-penalty  effective-IOPS
RAID0     24.0 TB  0 disks                1            1200
RAID1      4.0 TB  5 disks                6             480
RAID5     20.0 TB  1 disk                 4             632
RAID6     16.0 TB  2 disks                6             480
RAID10    12.0 TB  1 per pair             2             923

Run your program first, then open this and compare line by line: your output must contain these lines exactly.

How to give the file to my program

Terminal (macOS, Linux, or Windows Command Prompt), after compiling:

java Main < os11-3-data-1.txt

Windows PowerShell does not understand <:

Get-Content os11-3-data-1.txt | java Main

IntelliJ IDEA: Run → Edit Configurations → Redirect input from. Or simply paste the content of the file into the console when the program waits for input.

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.