Question: Question 3 : RAID ( Max Mark: 1 5 / 1 0 0 ) A Python program called raid.py that is provided simulates a RAID

Question 3: RAID (Max Mark: 15/100)
A Python program called raid.py that is provided simulates a RAID similar to what you have done in Task 11.2
Task: Provide tabulated results and answer the questions for each of the following parts.
(1) Use the timing mode of raid.py to obtain the following
(a) Total time for 100 random reads to the RAID with 4 disks at levels 0,1,4, and 5. You may use a range of 1000 and assume left-asymmetric RAID-5. Show the command and simulator outputs.
(b) As above but for 100 random writes. Show the command and simulator outputs.
(c) Tabulate the results obtained above.
(d) Based on the results you obtained, answer the following questions
(i) How do the read and write timing results compare across these four RAID levels? Which arrangement is the most efficient for reading and which one for writing.
(ii) Give reasons why the relative performances across RAID levels are as you tabled.
(2) Tabulate the timing results of 100 random writes to left-asymmetric RAID-5 for 4,5,6,7 and 8 disks. Show the commands and simulator outputs
Answer this question: Based on your results, how does the performance scale as the number of disks increases? Give plausible reason(s) for this observation.
raid.py:
#!/usr/bin/env python
import math
import random
from optparse import OptionParser
# minimum unit of transfer to RAID
BLOCKSIZE =4096
def convert(size):
length = len(size)
lastchar = size[length-1]
if (lastchar =='k') or (lastchar =='K'):
m =1024
nsize = int(size[0:length-1])* m
elif (lastchar =='m') or (lastchar =='M'):
m =1024*1024
nsize = int(size[0:length-1])* m
elif (lastchar =='g') or (lastchar =='G'):
m =1024*1024*1024
nsize = int(size[0:length-1])* m
else:
nsize = int(size)
return nsize
class disk:
def __init__(self, seekTime=10, xferTime=0.1, queueLen=8):
# these are both in milliseconds
# seek is the time to seek (simple constant amount)
# transfer is the time to read one block
self.seekTime = seekTime
self.xferTime = xferTime
# length of scheduling queue
self.queueLen = queueLen
# current location: make it negative so that whatever
# the first read is, it causes a seek
self.currAddr =-10000
# queue
self.queue =[]
# disk geometry
self.numTracks =100
self.blocksPerTrack =100
self.blocksPerDisk = self.numTracks * self.blocksPerTrack
# stats
self.countIO =0
self.countSeq =0
self.countNseq =0
self.countRand =0
self.utilTime =0
def stats(self):
return (self.countIO, self.countSeq, self.countNseq, self.countRand, self.utilTime)
def enqueue(self, addr):
assert(addr < self.blocksPerDisk)
self.countIO +=1
# check if this is on the same track, or a different one
currTrack = self.currAddr / self.numTracks
newTrack = addr / self.numTracks
# absolute diff
diff = addr - self.currAddr
if diff <0:
diff =-diff
# if on the same track...
if currTrack == newTrack or diff < self.blocksPerTrack:
if diff ==1:
self.countSeq +=1
else:
self.countNseq +=1
self.utilTime +=(diff * self.xferTime)
else:
self.countRand +=1
self.utilTime +=(self.seekTime + self.xferTime)
self.currAddr = addr
def go(self):
return self.utilTime
class raid:
def __init__(self, chunkSize='4k', numDisks=4, level=0, timing=False, reverse=False, solve=False, raid5type='LS'):
chunkSize = int(convert(chunkSize))
self.chunkSize = chunkSize / BLOCKSIZE
self.numDisks = numDisks
self.raidLevel = level
self.timing = timing
self.reverse = reverse
self.solve = solve
self.raid5type = raid5type
if (chunkSize % BLOCKSIZE)!=0:
print('chunksize (%d) must be multiple of blocksize (%d): %d'%(chunkSize, BLOCKSIZE, self.chunkSize % BLOCKSIZE))
exit(1)
if self.raidLevel ==1 and numDisks %2!=0:
print('raid1: disks (%d) must be a multiple of two' % numDisks)
exit(1)
if self.raidLevel ==4:
self.blocksInStripe =(self.numDisks -1)* self.chunkSize
self.pdisk = self.numDisks -1
if self.raidLevel ==5:
self.blocksInStripe =(self.numDisks -1)* self.chunkSize
self.pdisk =-1
self.disks =[]
for i in range(self.numDisks

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!