Assigned | Wednesday, January 18, 2017 |
---|---|
Due Date | Monday, January 30, 2017 at 5:00pm (17:00) |
Submissions | Submit a PDF file of your solutions to the course's Assignment Drop Box. |
The purpose of written homework assignments is to get you thinking about the topics being covered in lecture and in readings in the textbook that are not represented in the hands-on, programming lab assignments. These written assignments also better prepare you for exams. 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.
Please write up your answers one page per problem and submit them as a PDF file in the online dropbox. This simplifies our grading and ensures we read your answers clearly. We recommend that you type up your answers (Word or just plain-text is probably fine) as it ensures we can read them easily, but you may also scan a hand-written assignment and submit it as a PDF, provided it is legible.
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 around 4 or 5 days after the due date, in general, because some students may use late days.
Make sure you are using the 3rd edition of Computer Systems: A Programmer's Perspective. If you're not using the right book, you might be doing the wrong problems!
Answer the following problems, some from the 3rd edition of the textbook.
random()
generates a number between 0 and Tmax (not Umax; in other words: 0 to 231-1).Math.abs
for computing the absolute value of an int
:
public static void interesting(int x) { if (Math.abs(x) < 0) { System.out.println("absolutely strange"); } }
interesting
that
causes absolutely strange to be printed. What is that
argument in binary (base-2) and decimal (base-10)?
int
and what is its definition when given your answer to part (a)? Feel free to use web-search when answering this part.
M
and E
of the
representation. (Recall M
= Mantissa - 1.0 for normalized numbers.) Your answer
should contain these parts and you should show how you calculated
each value:
M
and E
exactly
as they will appear in the full 32-bit representation of 13.6875 in
IEEE floating point.objdump
to examine executable programs on Linux. Be sure to work on this problem
on the CSE home VM or attu. You will need a copy of the code that you
turned in for Lab 1 (your code does not have to be entirely correct or
complete, but at least some of your puzzle functions should be filled in).
make
in your Lab 1 directory to build your
code. Run the command objdump -t btest | grep text
and
examine the output. What type of thing
do some of the strings in the
rightmost column of the output
represent? (you do not need to identify
what all of them refer to)
objdump
to disassemble your btest code (review the lecture
slides or check the man page to find the right flag). Find the
labels in the assembly code corresponding to your bit puzzle functions.
What x86 assembly instructions appear to perform right-shift and
left-shift operations?
ldd
, file
, nm
,
strings
and
readelf
, and try other flags with objdump
. Report something
neat, unusual, or unexpected that you find. Don't forget to use the man
pages to learn more about all of these programs.
objdump -t
command on a
different program on the system - choose one in the /usr/bin/
directory. You will likely see the output "SYMBOL TABLE: no
symbols". Why does objdump -t
appear to work on your program,
but not on others?