Description
HW-7 CS451 10 points Due: Monday, October 15, 2018
RAID – Kills hard drives dead.
For this assignment you will write a program that simulates a 5-disk RAID
system. There will be five files (each a simulation of a drive) that contain
character-stripped data. These files are names as follows:
drive1.data
drive2.data
drive3.data
drive4.data
drive5.data
drive1.data will contain characters, for example:
16af
drive2.data will contain characters, for example:
27bg
drive3.data will contain characters, for example:
38ch
drive4.data will contain characters, for example:
49di
drive5.data will contain characters, for example:
50ej
Your main program must spawn 5 threads, where each thread will read from
one hard drive (thread 1 reads from drive1.data, etc). These threads must
be “detached” and free to read data as they wish. As a thread reads a
character from a drive (data MUST be read character by character) it must
pass that datum (character) back to the main program. The main program
then must assemble the stripped data into a single block of data.
Once all of the data has been read in the main program must display
the assembled block of data. So for the above example you would display:
1234567890abcdefghij
CAVEATS:
——–
1. You do not know how big the data files will be, but they will
be of equal size. There will not be blank spaces in the data files.
2. Since the threads are detached, you will need to devise some method
to synchronize them or synchronize the data. You must use a mutex as a
counting semaphore would make this too easy.
REQUIREMENTS:
————-
1. Your program must run on Mint.
2. Your full name must appear as a comment at the beginning of your
program.
3. Your source code must be named hw8-yourname.c or hw8-yourname.cpp