def GetMemory(title, FSB1, FSB2, FSB3, Rover):
word = raw_input("Enter the number of words you want to allocate: ")
print "GET_MEMORY IS RUNNING......."
print "Initial FSB list"
Print (title, fsb1, fsb2, gsb3, rover)
if int(word) <= fsb1[2]: # Size of area being returned
fsb[2] = fsb[2]-int(word)
fsb[1] = fsb[1]+int(word)
rover = fsb2[1]
print "Allocation request for " + word + " words"
print "Allocation was successful"
print "Allocation was in location " + str(fsb1[1]-int(word))
print(title, fsb1, fsb2, fsb3, Rover)
elif int(word) <= fab2[2]:
fab2[2] = fsb2[2] - int(word)
fsb2[1] = fab2[1] + int(word)
rover = fsb3[1]
print "Allocation request for"+words+" words"
print "Allocation was successful"
print "Allocation was in location" +str(fsb2[1] - int(word))
print(title, fsb1, fsb2, fsb3, Rover)
elif int(word) <= fab3[2]:
fab2[2] = fsb3[3] - int(word)
fsb2[1] = fab3[1] + int(word)
rover = fsb3[1]
print "Allocation request for"+words+" words"
print "Allocation was successful"
print "Allocation was in location" +str(fsb2[1] - int(word))
print(title, fsb1, fsb2, fsb3, Rover)
else:
print"Allocation request for 150 words" +words+" words"
print"Allocation was not successful"
print" . "
print" . "
print" . "
print"_____________________________________________________"
print"_____________________________________________________"
def FreeMemory(title, FSB1, FSB2, FSB3, Rover):
word = raw_input("Enter the number of words you want to de-allocate: ")
location = raw_input("Enter location")
print "FREE_MEMORY IS RUNNING......."
print "Initial FSB list"
Print (title, fsb1, fsb2, gsb3, rover)
if int(location) = fab1(1):
fab1(1) = int(location)
fab1(2) = fab1(2)+int(word)
print "De-Allocation request of "+words+" words at location" +location
elif int(location) = fab1(1):
fab2(1) = int(location)
fab2(2) = fab1(2)+int(word)
print "De-Allocation request of "+ words+" words at location" +location
elif int(location) = fab3(1):
fab2(1) = int(location)
fab2(2) = fab1(2)+int(word)
print "De-Allocation request of "+ words+" words at location" +location
print (title, fsb1, fsb2, fsb3, rover)
else:
print"De-Allocation request for 150 words" +words+" words"
print"De-Allocation was not successful"
print" . "
print" . "
print" . "
print"_____________________________________________________"
print"_____________________________________________________"
def Display(title, fsb1, fsb2, fsb3, Rover):
print " "join(title)
print fsb1
print fsb2
print fsb3
print "Rover is " +str(rover)
print"______________________________________________________________"
def main():
title = ['FSB#', 'Location', 'Size']
fsb1 = {1, 7, 4}
fsb2 = {2, 14, 10}
fsb3 = {3, 30, 20}
Rover = 14
getMemory(title, fsb1, fsb2, fsb3, Rover)
FreeMemory(title, fsb1, fsb2, fsb3, rover)
main()
# So for some typo or some reason this is not working any help would be appreciated
saugat.pradhan 0 Newbie Poster
zjtpjs4 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.