Homework
Notice: Practice session group 1 meets on Tuesday 4.12 at 14-16
(A318), not at 12-14 as normally.
Notice 2: Practice session Thursday groups 3 and 4 meet in week 50 on Friday
7.12 at 8-10 (B453) or Monday 10.12 at 8-10 (B453) due to 6.12 being
the Independence day. Students in groups 3 and 4 can attend the session that
suits them best.
Notice 3: There are altogether 33 homework points (hwp). The compulsory 1
point towards your grade is achieved with 10 hwp, and 12 points towards your
grade is given for 27 hwp. For example, doing all 5 problems in HW 6 will give
you 3 points toward your grade and will thus increase your grade by one step
(e.g., grade 1+/3 becomes 2-/3).
Computer Organization I, Fall 2001, HW 6
To be presented in weeks 49 and 50 (27.11-10.12.2001)
- Java programs (byte code) can be executed in (at least) four different
ways: interpretation, ordinary compilation, Just-In-Time compilation and
directly on a Java processor.
- Give examples on situation where interpretation would be better than
any other way. Give reasoning for your examples.
- Give similar examples and reasoning to situations where the other ways
to execute Java programs would be the best choise.
- What would be the best choise to execute (Java) programming laboratory
exercise? Why?
- Which prosesses are needed in the system at the time when your Java
program MyProg is executed with 1) interpretetation, 2) ordinary
compilation, 3) Just-In-Time compilation, or 4) Java processor?
- Java virtual machine. Assume the following. X, Y and Z are local variables
nr 3, 4, and 5. Tbl points to a 20 element array and it (Tbl) is stored into
local variable nr 6.
- Give machine instructions to increase value of X by 5.
- Give machine instructions to assign value Y+Z to X.
- Give machine instructions to assign value of Tbl[3] to Y
- Executing Java programs. Under what circumstances would a program written
in Java be faster/slower than a similar program implemented in C or C++?
Why?
- Self-modifying code. Some processors, including ttk-91, one can interpret
the contents of given memory location both as code and as data. This makes
it possible to create self-modifying programs. In a self-modifying program
one modifies instructions before they are executed. In some cases this may
lead to faster code than conventional approaches. For example, some often
executed selection can be completely left out, if (instead of executing
selection code) one has modified the instruction sequence to be executed. In
general, self-modifying code leads to complex programs that are difficult to
understand and very difficult to debug.
Make a self-modifying ttk-91 program, that has a code sequence that
- before modification would compute the sum of variables X and Y, and
- after modification will compute the product of variables X and Y.
I.e., an ADD instruction has been changed to MUL instruction.
The modification can be made, e.g., by replacing the complete
instruction, or by editing that instruction. Which method did you use? Can
you do the modification with the other method?
Hint: instruction "A ADD R2, R3"
can be loaded into R1 with ordinary "LOAD R1, A"
instruction.
- [1 hwp] Fill in the Student
Feedback form (only in Finnish, sorry). Give extra care in your answers
to questions 14 and 19. Bring answers to the following additional questions
also to the practice session for discussion.
In question 14 ("Miten kurssia voisi kehittää? or "How the
course could be made better") answer also to the
following:
- How many hours have you used for this class altogether up to now?
For lectures? Practices sessions? Self study?
- What proportion of the lectures did you attend to? (100%, 90%,
...)
- If you attended most lectures, did you learn the basic material there,
or did you have to study hard from the books.
- Did you use the English language books? How much?
In question 19 ("Muita kommentteja ..." or "Other
comments ...") answer also to the following:
- Did you gain enough from the practice sessions? Why?
- Did it bother you that no "model solutions" were given,
because answers for similar questions or examples were available in the
Web?
Use standard method for building and taking apart activation records, when
implementing subroutines and functions. Take care, that all work registers
(R0-R5) have the same value at the time of subroutine or function return as they
were when the subroutine or function call was made.
Be prepared to show all Koksi related and other programming homeworks using a
PC at the practice session. Please bring both a listing and on a diskette all
the programs you made for this practice session.
Teemu Kerola