Computer Organization I, Spring 2011, Exercise 6

You are expected to (try to) solve the problems on your own or with your study team before the meeting.

The problems are related to compilation and translations. It is not covered in the book. The goal is to create a bridge from programming language to machine instructions.

NOTICE:

Problems:

  1. Java programs (byte code) can be executed in (at least) four different ways: interpretation, ordinary translation, Just-In-Time translation, or directly in a Java processor.
    1. Give examples of a situation where interpretation would be better than all other ways. Give reasons, why the other execution types would be worse.
    2. Give similar examples and reasonings for situations where the other execution types mentioned above would be best.
    3. What would be the best execution mode (way) for Java programming lab project? Why?
    4. What processes are needed in the system, if your Java program MyProg is executed with 1) interpretation, 2) ordinary translation, 3) Just-In-Time translation, or 4) directly in a Java processor.
    5. When would you use C# instead of Java? What similarities/differencies are there with C# and Java?
    6. What is programming language Scala? What does it have to do with Java?
  2. Subroutines, macros, literals, variables, constants
    1. Give an example of a situation where routine XYZ would be better to implement as a macro than as a subroutine. Why? Example?
    2. Give an example of a situation where routine XYZ would be better to implement as a subroutine than as a macro. Why? Example?
    3. Give an example of a situation where constant value X would be better to implement as a literal than as a constant in the instruction. Why? Example?
    4. Give an example of a situation where constant value X would be better to implement as a constant in the instruction than a literal. Why? Example?
    5. How does using a literal differ from using a variable? Advantages? Disadvantages?
    6. How does using a literal differ from using constant field? Advantages? Disadvantages?
  3. What does program mystery.k91 do? How does it do it? What about program mystery3.k91? How does it do it?
    How could one use this type of programmig style? What problems does this type of programming have?
  4. [1 htp] Fill in the Student Feedback form.

  5. Do level E TitoTrainer problems e-300, e-310 and e-450.
    (If you want, you may do all other level e TitoTrainer problems)


Tiina.Niklander@cs.helsinki.fi