in English Toisella puolella suomeksi

Computer Organization I, course exam 28.4.2008   

Write in each answer sheat your name and signature, student id number, course name, and page nr.
  1. [9 p] Program, processor and system
    1. In what form is the program in execution seen by the processor?
    2. How is the program in execution executed by the processor?
    3. In what form is the program in execution seen by the operating system?
    4. How is the program in execution executed by the operating system?

  2.  
  3. [9 p] Processor privileged execution mode.
    1. What is privileged execution mode and what is it used for?
    2. How does the privileged execution mode differ from the (normal) user mode? Give two machine language examples.
    3. When and how is the execution mode changed from user mode to privileged mode?
    4. When and how is the execution mode changed from privileged mode to user mode?
       
  4. [9 p] I/O implementation. We have user level process (P), that wants to write a 512 byte data segment on disk. We use indirect I/O and I/O is implemented with device driver (D) and device controller process (C). Processes P and D execute on the normal processor (CPU) where as C executes on the device controller.
    1. How and when does the device driver D know what it should do? Who gives I/O-tasks to D and how?
    2. How and when does the device controller C know what it should do? Who gives instructions to C and how?
    3. How and when does the device driver D know that the data has been written on disk? Who tells that to D and how?
    4. How and when does the application P know that the data has been written on disk? Who tells that to P and how?
       
  5. [9 p] Titokone, TitoTrainer and ttk-91. Function PosSum(T, N) returns the sum of positive (>0) numbers in N-element array T. T is a call-by-reference parameter and N is a call-by-value parameter. Variable X and 50 element array Weights[50] are defined in main program level.
    1. Use symbolic ttk-91 assembly language to implement statement X = PosSum (Weights, 50).
    2. Use symbolic ttk-91 assembly language to implement function PosSum.
    3. Assume now that we want to compute the sum of positive values in array Weights, but only considering array elements Weights[10], ..., Weights[30].
      Implement this with symbolic ttk-91 assembly language with proper call to function PosSum.

    Follow the recommended subroutine (function) 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, JEQU, JGRE, JNLES, JNEQU, JNGRE, CALL, EXIT, PUSH, POP, PUSHR, POPR, SVC