Question: Question 3 : RAID ( Max Mark: 1 5 / 1 0 0 ) A Python program called raid.py that is provided simulates a RAID
Question : RAID Max Mark:
A Python program called raid.py that is provided simulates a RAID similar to what you have done in Task
Task: Provide tabulated results and answer the questions for each of the following parts.
Use the timing mode of raid.py to obtain the following
a Total time for random reads to the RAID with disks at levels and You may use a range of and assume leftasymmetric RAID Show the command and simulator outputs.
b As above but for 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.
Tabulate the timing results of random writes to leftasymmetric RAID for and 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 reasons for this observation.
raid.py:
#usrbinenv python
import math
import random
from optparse import OptionParser
# minimum unit of transfer to RAID
BLOCKSIZE
def convertsize:
length lensize
lastchar sizelength
if lastchar k or lastchar K:
m
nsize intsize:length m
elif lastchar m or lastchar M:
m
nsize intsize:length m
elif lastchar g or lastchar G:
m
nsize intsize:length m
else:
nsize intsize
return nsize
class disk:
def initself seekTime xferTime queueLen:
# 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
# queue
self.queue
# disk geometry
self.numTracks
self.blocksPerTrack
self.blocksPerDisk self.numTracks self.blocksPerTrack
# stats
self.countIO
self.countSeq
self.countNseq
self.countRand
self.utilTime
def statsself:
return selfcountIO, self.countSeq, self.countNseq, self.countRand, self.utilTime
def enqueueself addr:
assertaddr self.blocksPerDisk
self.countIO
# 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 :
diff diff
# if on the same track...
if currTrack newTrack or diff self.blocksPerTrack:
if diff :
self.countSeq
else:
self.countNseq
self.utilTime diff self.xferTime
else:
self.countRand
self.utilTime selfseekTime self.xferTime
self.currAddr addr
def goself:
return self.utilTime
class raid:
def initself chunkSizek numDisks level timingFalse, reverseFalse, solveFalse, raidtypeLS:
chunkSize intconvertchunkSize
self.chunkSize chunkSize BLOCKSIZE
self.numDisks numDisks
self.raidLevel level
self.timing timing
self.reverse reverse
self.solve solve
self.raidtype raidtype
if chunkSize BLOCKSIZE:
printchunksize d must be multiple of blocksize d: dchunkSize BLOCKSIZE, self.chunkSize BLOCKSIZE
exit
if self.raidLevel and numDisks :
printraid: disks d must be a multiple of two' numDisks
exit
if self.raidLevel :
self.blocksInStripe selfnumDisks self.chunkSize
self.pdisk self.numDisks
if self.raidLevel :
self.blocksInStripe selfnumDisks self.chunkSize
self.pdisk
self.disks
for i in rangeselfnumDisks
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
