Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

1(a) Draw the state of the memory just before line 43 executes 1(b) Draw the state of the memory just before line 23 executes I(c)

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

1(a) Draw the state of the memory just before line 43 executes 1(b) Draw the state of the memory just before line 23 executes I(c) Draw the state of the memory just before line 45 executes 1(d) Draw the state of the memory just before line 17 executes 1e) Draw the state of the memory just before line 47 executes. 1(f) Draw the state of the memory just before line 29 executes 1(g) Draw the state of the memory just before line 49 executes. 1Ch) Draw the state of the memory just before line 35 executes. 1) Draw the state of the memory just before line 51 executes Note: The execution that you are tracing would mimic if you were to run the code with a breakpoint on the following lines: 17,23,29,35,43,45,47,49,51. The idea here is to step through the execution of the mairn function and draw the state of the program just before the first call on line 44 to swapByRef, just before the first line of each swap function is executed, and just before the line after each swap function is executed. Memory addresses are locations of bytes in memory. To compute memory addresses, . assume that the stack addresses start at 0x7ff4440 and grow downward (the first element on the stack will have an address lower than 0x7ff 4440 and the next will go lower) assume that the heap addresses start at 0x40000 and grow upward (the first element on the heap is at 0x40000 and the next is higher), assume that blocks will be allocated consecutively, and assume that this is a 64-bit system with 32-bit integers. Feel free to use a hex calculator to perform the address arithmetic (8 bytes per address, 4 bytes per int). You can draw references simply by putting the name inside the box it references instead of allocating new memory (this isn't quite accurate, but suffices for our purposes) 1(a) Draw the state of the memory just before line 43 executes 1(b) Draw the state of the memory just before line 23 executes I(c) Draw the state of the memory just before line 45 executes 1(d) Draw the state of the memory just before line 17 executes 1e) Draw the state of the memory just before line 47 executes. 1(f) Draw the state of the memory just before line 29 executes 1(g) Draw the state of the memory just before line 49 executes. 1Ch) Draw the state of the memory just before line 35 executes. 1) Draw the state of the memory just before line 51 executes Note: The execution that you are tracing would mimic if you were to run the code with a breakpoint on the following lines: 17,23,29,35,43,45,47,49,51. The idea here is to step through the execution of the mairn function and draw the state of the program just before the first call on line 44 to swapByRef, just before the first line of each swap function is executed, and just before the line after each swap function is executed. Memory addresses are locations of bytes in memory. To compute memory addresses, . assume that the stack addresses start at 0x7ff4440 and grow downward (the first element on the stack will have an address lower than 0x7ff 4440 and the next will go lower) assume that the heap addresses start at 0x40000 and grow upward (the first element on the heap is at 0x40000 and the next is higher), assume that blocks will be allocated consecutively, and assume that this is a 64-bit system with 32-bit integers. Feel free to use a hex calculator to perform the address arithmetic (8 bytes per address, 4 bytes per int). You can draw references simply by putting the name inside the box it references instead of allocating new memory (this isn't quite accurate, but suffices for our purposes)

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_2

Step: 3

blur-text-image_3

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students explore these related Databases questions