Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use C to solve and use Struct not bitwise. Thank you You will writ progrm whih mintins hp. Your progrm will llow usr to

Please use C to solve and use Struct not bitwise. Thank you

You will writ progrm whih mintins hp. Your progrm will llow usr to llot

mmory, fr mmory, nd s th urrnt stt of th hp. Your progrm will pt usr

ommnds nd xut thm.

ssumptions bout th hp

Th hp is 127 byts long nd mmory is byt-ddrssbl. Th first ddrss of th hp is

ddrss 0, so th lst ddrss of th hp is ddrss 126. Whn w rfr to pointr in this

ssignmnt w mn n ddrss in mmory. ll pointrs should thrfor b vlus btwn 0

nd 126.

Th hp will b orgnizd s n impliit fr list. Th hp is initilly ompltly unllotd,

so it should ontin singl fr blok whih is s big s th ntir hp. Mmory is initilizd

so tht ll ddrsss (othr thn th hdr of th initil fr blok) ontin 0. h blok

should hv hdr whih is singl byt nd th hdr byt should b ontind in

mmory, just bfor th pylod of th blok. Th most-signifint 7 bits of th hdr should

indit th siz of th blok, inluding th hdr itslf. Th lst signifint bit of th hdr

should indit th llotion of th blok: 0 for fr, 1 for llotd. Th hdr for th first

blok (th initil singl fr blok) must b pld t ddrss 0 in mmory.

Oprtions

Your progrm should provid prompt to th usr (>) nd pt th following ommnds.

mllo - This oprtion llows th usr to llot blok of mmory from your hp. This

oprtion should tk on rgumnt, th numbr of byts whih th usr wnts in th pylod

of th llotd blok. This oprtion should print out pointr whih is th first ddrss of th

pylod of th llotd blok.

xmpl:

>mllo 10

1

>mllo 5

12

>mllo 2

18

fr - This oprtion llows th usr to fr blok of mmory. This oprtion tks on

rgumnt, th pointr to th pylod of prviously llotd blok of mmory. You n

ssum tht th rgumnt is orrt pointr to th pylod of n llotd blok.

xmpl:

>mllo 10

1

>mllo 5

12

>fr 12

>fr 1

bloklist - This oprtion prints out informtion bout ll of th bloks in your hp. Th

informtion bout bloks should b printd in th ordr tht th bloks r ontind in th

hp. Th following informtion should b printd bout h blok: pointr to th pylod,

blok siz, nd th llotion sttus (llotd of fr). ll thr itms of informtion bout

singl blok should b printd on singl lin nd should b sprtd by omms.

xmpl:

>mllo 10

1

>mllo 5

12

>bloklist

1, 10, llotd

12, 5, llotd

18, 109, fr

writmm This oprtion writs lph-numri hrtrs into mmory. Th oprtion tks

two rgumnts nd thr should b no mpty sps or null hrtr t th nd of th input.

Th first rgumnt is pointr to th lotion in mmory nd th sond rgumnt is

squn of lph-numri hrtrs whih will b writtn into mmory, strting t th

ddrss inditd by th pointr. Th first hrtr will b writtn into th ddrss inditd

by th pointr, nd h hrtr thrftr will b writtn into th nighboring ddrsss

squntilly. For xmpl, th oprtion writmm 3 b will writ n into ddrss 3,

b into ddrss 4, nd into ddrss 5.

You n ssum tht th pointr rgumnt will lwys b n ddrss in th hp, ssum tht

ll of th hrtrs will b writtn into ddrsss in th hp.

printmm This oprtion prints out sgmnt of mmory in hxdiml. Th oprtion

tks two rgumnts. Th first rgumnt is pointr to th first lotion in mmory to print,

nd th sond rgumnt is n intgr inditing how mny ddrsss to print. Th ontnts of

ll ddrsss will b printd on singl lin nd sprtd by singl sp.

xmpl:

>writmm 5 B

>printmm 5 3

41 42 43

Noti tht th vlus 41, 42, nd 43 r th hxdiml rprsnttions of th SII vlus of

th hrtrs , B, nd .

quit This quits your progrm.

Rquirmnts bout llotion nd fring of mmory

Whn blok is rqustd whih is smllr thn ny xisting blok in th hp, thn your od

must prform splitting to rt nw blok of th pproprit siz.

Whn blok is frd, it must b olsd with th nxt blok if th nxt blok is fr. Whn

blok is frd, it DOS NOT nd to b olsd with th prding blok.

Whn srhing for blok to llot, b sur to us th bst-fit llotion strtgy.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions

Question

Describe the audit procedures the auditor uses to obtain evidence.

Answered: 1 week ago

Question

=+6 Who is the peer of the IA ?

Answered: 1 week ago

Question

=+herself to in terms of equity with regard to this assignment?

Answered: 1 week ago