Today : Sat, 16 Nov 19 .


CS 537 - Operating Systems - Spring 2013


HomePage Discussion Moodle Instructors Schedule Lectures Sections Readings Homeworks

Projects

edit SideBar

Project3-sp13

Page: PmWiki.Project3-sp13 - Last Modified : Wed, 03 Apr 13

Software RAID

Notes

  • 4/3: modified version of p3src.zip available that prints disk stats on failure and zeros disk stats on recovery. NOTE: You do not need to download this, and it may cause current tests to fail.
  • 4/3: update due date to Friday, April 5th at 9 pm
  • 4/3: correct RAID 4 and 5 description to refer to "full stripe" instead of "full strip" when discussing calculating parity.
  • 4/2: updated p3src.zip to automatically empty a disk during recovery.
  • 4/1: clarified FAIL and RECOVER commands.DISK refers to the number of the disk that failed.
  • 3/28: updated p3src.zip to fix typo in stats code in disk.c
  • 3/25: updated p3src.zip to include code to print stats.
  • p3src.zip updated 3/21 to fix a memory corruption problem.
  • 3/23: Updated output section to explain error outputs

Due date

The project is due at 9 pm on Thursday, April 5th

Groups

This is a group project done in groups of three. If you know who you would like to work with, please notify the instructors. Otherwise we will make a group for you.

Objectives

The goals for this project are:

  • Develop better understanding of the specifics of different RAID implementations
  • Analyze tradeoffs in RAID write strategies
  • Understand data recovery strategies

Overview

In this system you will implement a software RAID manager implementing RAID 0 (striping), RAID 1 (mirroring), RAID 4 (fixed parity disk), and RAID 5 (floating parity), and RAID 10 (mirroring + striping). For each strategy, you will implement a RAID manager capable of normal mode operation (no failures), failed-mode operation (working with one failed disk), and recovery (restoring normal mode with a new disk).

Rather than assign each of you a set of real disks, we will instead work with virtual disks stored in ordinary files. Thus, we won't be able to accurately measure the performance impact of different RAID systems. Instead, we will simply count the number of accesses per disk and use that as a proxy for performance.

Details

You will create a simulator program named raidsim.

Virtual disk array

This file contains source for a virtual disk array. Please use the functions defined in disk-array.h. The file test.c shows how to use the functions. The block size for the project is defined in disk.h.

RAID 0

Blocks should be striped across disks, starting with the lowest numbered disk and increasing. Each disk gets a strip of blocks, which is one or more blocks. For example, with 3 disks and strip size of 2, disk 0 gets blocks 0-1 and 6-7, disk 1 gets blocks 2-3 and 8-9, and disk 3 gets blocks 4-5 and 10-11.

RAID 10

Blocks should be mirrored between pairs of disks and then striped across pairs of disks in strip units. Mirrors should be disk i and i+1. For example, with 4 disks and strip size 2, disks 0 and 1 get blocks 0-1 and 4-5, and disks 2 and 3 gets blocks 2-3 and 6-7.

RAID 4

Blocks should be striped in strip size units across the first n-1 disks, and disk n should receive the parity. For 4 disks and strip size 3, disk 0 gets blocks 0-2 and 9-11, disk 1 gets blocks 3-5 and 12-14, disk 2 gets blocks 6-8 and 15-17. The parity disk gets the byte-wise XOR of the n-1 data disks. In this case, block 0 XOR block 3 XOR block 6, block 1 XOR block 4 XOR block 7, block 2 XOR block 5 XOR block 8 etc.

For writes less than a full stripe, you can use additive (read the old blocks and compute new parity) or subtractive (read the old block and old parity) parity. For writes to a full stripe, just write out the data and new parity.

RAID 5

Blocks should be striped in strip size units across N disks, reserving one disk for parity. For the first strip, disk 0 should be used for parity, for the second disk 1 etc. For stripe, parity returns to disk 0. For example, with strip size 1 and 4 disks

Disk 0Disk 1Disk 2Disk 3
B0 XOR B1 XOR B2B0B1B2
B3B3 XOR B4 XOR B5B4B5
B6B7B6 XOR B6 XOR B8B8
B9B10B11B9 XOR B10 XOR B11
B13 XOR B14 XOR B15B13B14B15

For writes less than a full stripe, you can use additive (read the old blocks and compute new parity) or subtractive (read the old block and old parity) parity. For writes to a full stripe, just write out the data and new parity.

Specification

Command line

Command line parameters (these can come in any order):

  • -level [0|10|4|5] specifies the RAID level as 0, 10, 4, or 5
  • -strip n specifies the number of blocks in a strip.
  • -disks n specifies the use of n disks. Some RAID levels may require an even number of disks (RAID 10) or more than 2 disks (RAID 4 and 5)
  • -size n specifies the number of blocks per disk
  • -trace filename specifies the name a file containing a trace of requests
  • -verbose set the global variable "verbose" to 1 (defaults to 0).

All parameters are mandatory except "verbose". A sample command line:

  raidsim -level 10 -strip 5 -disks 10 -size 10000 -trace input.txt

Trace file format

The trace file contains a sequence of lines with one command per line. There will be exactly one space between each word in a command. The commands can be:

  • READ LBA SIZE - read starting at block LBA for SIZE blocks. Prints out the first 4 byte value in each block, separated by spaces on a single line.
  • WRITE LBA SIZE VALUE - write the 4-byte pattern VALUE repeatedly starting at block LBA for SIZE blocks.
  • FAIL DISK - make disk number DISK fail, so it cannot be read or written any more. No output
  • RECOVER DISK - make disk number DISK recover as a clean, empty disk that can be read or written. No output
  • END - last command in trace

For each RAID type, your simulator should try to complete as much of a command as possible: return as much data as possible on a read and write as much data as possible on a write.

Output:

Your simulator should print the command line from the trace and then execute it, then print the desired output on the following line. After the END command, your simulator should call disk_array_print_stats() to print the statistics for the disks. On read errors, replace the value (which may be one of many in a set of blocks) with the word ERROR. Thus, a read may return a mix of values and an error. On write errors, print ERROR if any blocks of the write cannot be written.

What to turn in

We will provide a file disk.c containing the disk emulator that keeps statistics. You should turn in a makefile and all your source files. The makefile should produce a program named raidsim. If you include disk.c, we will replace it with our own before compiling your code. Please turn the code to ~cs537-2/handin/<yourlogin>/p3.

You should turn in one project per group. With your project, please include a file name README.TXT listing the names and CS logins of your group members.

Grading Criteria

We will consider the following aspects of your code:

  • Does it produce the correct sequence of disk accesses for each implementation of RAID?
  • Does it produce the correct output values from READ commands for each implementation of RAID?
  • Are there memory corruption problems or memory leaks? You may want to run Valgrind.


This page may have a more recent version on pmwiki.org: PmWiki:Project3-sp13, and a talk page: PmWiki:Project3-sp13-Talk.


Powered by PmWiki
Skin by CarlosAB

looks borrowed from http://haran.freeshell.org/oswd/sinorca
More skins here