Question: ( 1 5 marks ) In some computer systems, R M is separated into sections. Usually one section is used for variables, another for function

(15 marks) In some computer systems, R M is separated into sections. Usually
one section is used for variables, another for function call parameters, etc. In
this problem there will be two sections: variables and function call parameters.
Variables expand from one area of the RAM and function call parameters from the
other end (see diagram).
The amount of RAM is fixed. Think of RAM as one large static array, with one
end used for some purpose (in this case variables), and other end being used for a
different purpose (in this case function call parameters). The memory allocations
for these 'grow' towards each other. If the two ends ever meet, then the memory
has been exhausted. As you may have noticed, memory allocation and removal
behave like a Stack.
(a) In this question you will partially simulate this behaviour for the Microvision
handheld game console. The requirements for this simulation:
The R M size is 64 bytes.
Allocations at the 'bottom' are for variables; 'top' are for parameters, just
like in the diagram.
When testing, you can add (random) characters to represent variables/-
parameters. You may assume each allocation is 1 byte (fixed size).
You will implement this using one 1-D array, which combines two stacks. You
will need to implement the following operations:
isEmpty (for each R M area)
size (for each R M area)
allocate (add an item to the proper RAM area, if space is available)
free (for each R M area)
top (for each R M area)
Do not use the built-in append or pop function, as these can change the size
of the aray.
(b) Fully test all operations in a Python main program, including all corner cases
(i.e. test for memory exhaustion).
(c) Give the time complexity for each of the operations, with justifications.
 (15 marks) In some computer systems, R M is separated into

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!