Question: Operating System 1) implementing and testing the GET-MEMORY algorithm This algorithm uses the Next-Fit(First-Fit-With-A-Roving-Pointer) technique. 2) implementing and testing the FREE-MOMORY algorithm (Both algorithms are

Operating System

1) implementing and testing the GET-MEMORY algorithm

This algorithm uses the Next-Fit(First-Fit-With-A-Roving-Pointer) technique.

2) implementing and testing the FREE-MOMORY algorithm (Both algorithms are under RESOURCES are below in picture).

Implement the GET_MEMORY and FREE_MEMORY algorithms. Comprehensive testing must be done for each algorithm.

Following are sample run results for each:

GET_MEMORY IS RUNNING

Initial FSB list

FSB# Location Size

1 7 4

2 14 10

3 30 20

. . .

. . .

Rover is 14

----------------------------------------------------------------------------

Allocation request for 5 words

Allocation was successful

Allocation was in location 14

FSB# Location Size

1 7 4

2 19 5

3 30 20

. . .

. . .

Rover is 30

----------------------------------------------------------------------------

Allocation request for 150 words

Allocation was not successful

.

.

.

__________________________________________________________

FREE_MEMORY IS RUNNING..

Initial FSB list

FSB# Location Size

1 7 4

2 19 5

3 30 20

. . .

. . .

Rover is 30

----------------------------------------------------------------------------

De-allocation request of 4 words at location 3

FSB# Location Size

1 3 8

2 19 5

3 30 20

. . .

. . .

Rover is 30

----------------------------------------------------------------------------

Operating System 1) implementing and testing the GET-MEMORY algorithm This algorithm uses

the Next-Fit(First-Fit-With-A-Roving-Pointer) technique. 2) implementing and testing the FREE-MOMORY algorithm (Both algorithms

Begin GET MEMORY Allocate space from a list of FSBs using the frst r technique Input -SZE of area desired (must be two or more words) -SCB containing the FSB head node as defined in Figure 2-7 -STATUS of the GET MEMORY operation - LOCATION of the area, if allocation is Output successful -FSB list structure is modified Assume Minimum allocation of two words in order that a returned area may be structured into an FSB (see Algorithm 2-2 Default STATUS to failure Initialize PREVIOUS pointer to ROVER from the head node Do Set CURRENT to linklPREVIOUS) If the current block is adequate, l.?., size(CURRENT) Then Allocate space from the current block SIZE or Set LOCATION to the last SZE words of the block, Le., to CURRENT size(CURRENT) SIZE If all of the block is needed, i.e,LOCATIONCURRENT Then I Delink the FSB from the list I Else Shorten the FSB EndIf Save a new roving-pointer value in the head node, ie, set ROVER Change STATUS to success Advance PREVIOUS to CURRENT to continue searching Set link(PREVIOUS) to link(CURRENT) Decrement sizelCURRENT by SIZE to PREVIOUS Else Endlf Until an area is allocated or the list is exhausted, ie., STATUS-suecess CURRENT ROVER EndDo Algorithm 2-1 First-Fit with a-Roving-Pointer Allocation be validated. The normal action upon detection of incorrect conditions is to abort execution of the calling process Code to validate the input SIZE is essential. In addition, when the tests for adjacency with neighboring blocks are made, the FREE MEMORY routine should also test for overlapping blocks; that is, does the new area extend beyond the starting address of the successor or begin before the end of the predecessor? Begin GET MEMORY Allocate space from a list of FSBs using the frst r technique Input -SZE of area desired (must be two or more words) -SCB containing the FSB head node as defined in Figure 2-7 -STATUS of the GET MEMORY operation - LOCATION of the area, if allocation is Output successful -FSB list structure is modified Assume Minimum allocation of two words in order that a returned area may be structured into an FSB (see Algorithm 2-2 Default STATUS to failure Initialize PREVIOUS pointer to ROVER from the head node Do Set CURRENT to linklPREVIOUS) If the current block is adequate, l.?., size(CURRENT) Then Allocate space from the current block SIZE or Set LOCATION to the last SZE words of the block, Le., to CURRENT size(CURRENT) SIZE If all of the block is needed, i.e,LOCATIONCURRENT Then I Delink the FSB from the list I Else Shorten the FSB EndIf Save a new roving-pointer value in the head node, ie, set ROVER Change STATUS to success Advance PREVIOUS to CURRENT to continue searching Set link(PREVIOUS) to link(CURRENT) Decrement sizelCURRENT by SIZE to PREVIOUS Else Endlf Until an area is allocated or the list is exhausted, ie., STATUS-suecess CURRENT ROVER EndDo Algorithm 2-1 First-Fit with a-Roving-Pointer Allocation be validated. The normal action upon detection of incorrect conditions is to abort execution of the calling process Code to validate the input SIZE is essential. In addition, when the tests for adjacency with neighboring blocks are made, the FREE MEMORY routine should also test for overlapping blocks; that is, does the new area extend beyond the starting address of the successor or begin before the end of the predecessor

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 Databases Questions!