581305-6 Computer Organization I                                (toisella puolella suomeksi in English)
course examination 6.9.2002  (Open Univ.)

Write in each answer sheet your name, signature, id-number, course name, and page nr/total nr of pages
  1. [12 p] Process.
    1. [2 p] Define concept prosessi. How does it differ from program?
    2. [2 p] What is the representation of a process is system? What data is in it? Where is it located?
    3. [2 p] What is a system process? How does it differ from ordinary process?
    4. [2 p] What happens in the system during process switch? What happens to the previous process?
    5. [2 p] Give an example of a situation where process state changes from "Running" to "Ready-to-Run"?
    6. [2 p] Give an example of a situation where process in state "waiting" changes first to state "Ready-to-Run" and then immediately to state "running".


  2. [12 p] Instruction execution.
    1. [2 p] How is ttk-91 instruction "ADD  R2, VarX(R1)" represented in memory?
    2. [4 p] What happens in the processor during machine instruction "ADD  R2, VarX(R1)" execution in different phases of the exection cycle?
    3. [3 p] Define concept interrupt (exception). What type of interrupts are there? How are interrupts handled in the processor?
    4. [3 p] What interrupts can occur during the execution of machine instruction "ADD  R2, VarX(R1)"?



  3. [12 p] Java
    1. [3 p] What is common in executing Java-programs with executing ttk-91 programs in Koksi simulator?
    2. [3 p] What is different in executing Java-programs with executing ttk-91 programs in Koksi simulator?
    3. [3 p] What is Java Virtual Machine (JVM)? Why is it important?
    4. [3 p] How does JVM differ from ordinary processors (E.g., Intel Pentium, IBM PowerPC, AMD Athlon)?


  4. [12 p]  Implementation of subroutines/functions 
    1. [3 p] How are subroutines implemented at machine language level? What aspects are important in subroutine implementation?
    2. [1 p] What is special in implementing recursive subroutines?
    3. [4 p] Function Aver(A, B, C, D) returns as its value the average of for integer values given to it as parameters.
      The parameters are all call-by-value parameters.  Give in Ttk-91 symbolic assembly language a program, that  (i) reads four interger values, (ii) computes the average of those values with function Aver,  and (iii) finally prints out the average.
    4. [4 p] Implement the function Aver(A, B, C, D) given in part (c) with ttk-91 symbolic assembly language.
Follow the subroutine (function) implementation and call mechanism introduced in lectures and in practice sessions. 
 
TTK-91 assembly language instructions are: NOP, STORE, LOAD, IN, OUT, ADD, SUB, MUL, DIV, MOD, AND, OR, XOR, SHL, SHR, COMP, JUMP, JNEG, JZER, JPOS, JNNEG, JNZER, JNPOS, JLES, JEQU, JGRE, JNLES, JNEQU, JNGRE, CALL, EXIT, PUSH, POP, PUSHR, POPR, SVC