581305-6 Computer Organization I, 2 ov, term exam 18.12.2000     (toisella puolella suomeksi in English)

Write in each answer sheet: your name and signature, id-number, course name, and page nr/total nr of pages
  1. [12 p] Memory hierarchy

    1. [4 p] Data referenced in machine instructions can be physically located in many memory hierachy levels (physical device or system). Give four examples of different speeds.

    2. [6 p] For each level, give a machine language example where data (not code) at that level is referenced. At what phase of the machine language instruction execution that reference occurs? Explain why reference in your example occurs at that given level and not at (either) adjacent level.

    3. [2 p] For each level, give a machine language example where code (not data) at that level is referenced. At what phase of the machine language instruction execution that reference occurs? Explain why reference in your example occurs at that given level and not at (either) adjacent level.

  2. [12 p] I/O implementation. Assume that user level program MyProg wants to read the 50 first characters of disk file MyFile into an array (table) MyChars, that is defined as a (global) array in program MyProg. Assume that the file reading is done with library routine ReadFile(MyFile, 50, MyChars).

    You may assume that control does not return from ReadFile until those 50 characters have been read to MyChars. You may also (unrealistically) assume that file MyFile is open and directly usable with ReadFile.

    1. [4 p] Which processes and/or devices are involved with implementing this I/O. For each process/device explain briefly what is its task in implementing this I/O.

    2. [8 p] Descibe as event series what happens at process level in the system, starting from call to ReadFile until the return from ReadFile. Especially explain, which process/device is active and when. Include all those events, that somehow cause some process to change its state (waiting, ready-to-run, running or executing). For each not-executing process, explain which event it is waiting for.

    Make (realistic) assumptions from missing information and write them down. Your assumptions are significant in evaluating your answer.

  3. [12 p] There are at least least three very different approaches to execute Java programs. Describe these approaches. Give special attention to how Java programs are executed at processor machine language level and how each approach differs from the others in this respect. Explain also the advantages/disadvantages of each approach as compared to the other approaches. Your answer should not be longer than 3 pages.

    Bonus question [1 p]: Which Java program execution approach is best related to the implementation of Transmeta Crusoe processor. Why?

  4. [12 p] Each element of array Person[0..9] is a record, that has three integer fields: Age, ShoeSize and Height.

    1. [4 p] Give the ttk-91 symbolic assembly language definition of the global data structure Person. Give also the pseudo instructions with which one can easily identify the record fields and with which it is easy to access those fields. It is sufficient to define the data structure; you do not need to initialize it.

    2. [4 p] Give the ttk-91 symbolic assembly language instructions with which to implement the assigment statement Person[i].ShoeSize = ShSize; (array Person element i field ShoeSize value is changed to the value of variable ShSize).
      You may assume that, that variables i and ShSize are global. You may also (unrealistically) assume that the values for variables i and ShSize are sensible.

    3. [4 p] Using the ttk-91 symbolic assembly language implement subroutine SetHeight(Arr, k, val), which sets the value of field Height of the k'th element in type Person array Arr to the value of variable val.
      Arr is a call-by-reference parameter and the other parameters are call-by-value.
      You may (unrealistically) assume that parameter values are sensible.
      Assume the customary subroutine (function) implementation and call mechanism.


TTK-91 assembly language instructions are: NOP, STORE, LOAD, IN, OUT, ADD, SUB, MUL, DIV, MOD, AND, IR, XOR, SHL, SHR, COMP, JUMP, JNEG, JZER, JPOS, JNNEG, JNZER, JNPOS, JLES, LEQU, JGRE, LNLES, LNEQU, NGRE, CALL, EXIT, PUSH, POP, PUSHR, POPR, SVC