Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ program Implement a dynamic storage allocation algorithm You are to implement 1 (one) dynamic storage allocation algorithm in the C++ language. The algorithm used
C++ program Implement a dynamic storage allocation algorithm You are to implement 1 (one) dynamic storage allocation algorithm in the C++ language. The algorithm used is to be Worst Fit. You are to test the algorithm with a set of test data provided by the instructor. For this assignment, assume that memory size is 32 blocks. The logic of the main program should be something like the following: repeat accept (command, job number, space needed) echo check case command of allocate : begin if space exists for the entire request then begin allocate storage for this job print the starting location of the allocated block print a memory map of space used and space available print the wait queue end else begin put the allocation request in a wait queue print the wait queue increment the count end end deallocate : begin if space for the job specified is being used then deallocate the space for the job number given else delete the request from the wait queue (If it's there) for all items in the wait queue do begin if space exists for the entire request then begin allocate storage for the job remove the request from the wait queue print the wait queue end end print the memory map print the wait queue end end case until end of file print some message, count Use the following test data... a 1 16 a 2 8 a 3 8 d 1 0 a 4 12 d 3 0 a 5 32 a 6 16 d 2 0 a 7 16 a 8 24 d 6 0 a 9 4 a 10 4 a 11 4 a 12 8 a 13 2 d 9 0 d 10 0 d 11 0 d 5 0 d 7 0 d 4 0 d 13 0 d 12 0 d 8 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started