CSE 410 Homework 2: Function Calls and Optimizations

Assigned Monday, October 28, 2013
Due Date Tuesday, November 5 at 11:00 pm No late assignments accepted (even if you have late days remaining). We want to hand out sample solutions the following day so they are available while studying for the midterm exam.

Introduction

The purpose of written homework assignments is to get you thinking about the topics being covered in lecture and in readings in the textbook which are not represented in the hands-on, programming lab assignments. These written assignments also better prepare you for course examinations. It is worth noting that the book contains many practice problems similar to the problems we ask on these written assignments. The solutions for those practice problems are located at the end of each chapter and should give you a feel for the kind of answers we expect you to turn in for these kind of assignments.

Logistics

Please write up your answers and submit them as a PDF file in the online dropbox. This simplifies our grading and ensures we read your answers clearly. If you don't know how to create a PDF, a quick internet search should help, or ask us. You may submit a scanned file with a hand-written solution as long as the file is legible and is not too large (a few MB max, please).

We will provide solutions to all of the problems in the written homework assignments in a timely fashion after the assignment is due. This may be several days after the due date, in general, because a student may use up to 2 late days on an assignment.

Questions

From the textbook (including some practice problems, do them on your own first, you may then check your answers at the end of the chapter, make sure you understand the solution provided, turn in your answer to each corresponding question below as part of your write-up - you do NOT need to turn in the answer to the practice problem in its entirety - just enough to explain your answer to the question below):

  1. Practice Problem 3.30, Is the stack affected after executing these two instructions? If so, how? If not, why not?
  2. Practice Problem 3.33, How would you change the assembly code to eliminate the space that the compiler wasted on the stack?
  3. Practice Problem 3.42, Can you describe a general strategy for arranging elements of a struct so that the space the struct uses is minimized?
  4. Homework Problem 3.62
  5. Homework Problem 3.64

Notes

Be sure you are using the 2nd edition of Computer Systems: A Programmer's Perspective. If you're not using the right book, you might be doing the wrong problems!

Submitting Your Work

Please submit a PDF file with your solutions using the Catalyst drop box linked from the CSE 410 main web page.