581305-6 Computer Organization I, 2 ov, final exam 26.3.2002     (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. [15 p] Process
    1. [5 p] How is process represented in system? Where is the data for each process during different process states? In processor, memory, disk?
    2. [2 p] Give an example of a situation where process state changes from "New" to "Blocked"?
      What happens in the system during this state change?
    3. [2 p] Give an example of a situation where process state changes from "Running" to "Blocked"?
      What happens in the system during this state change?
    4. [2 p] Give an example of a situation where process state changes from "New" to "Ready"?
      What happens in the system during this state change?
    5. [2 p] Give an example of a situation where process state changes from "Blocked" to "Ready"?
      What happens in the system during this state change?
    6. [2 p] Give an example of a situation where process state changes from "Ready" to "Running"?
      What happens in the system during this state change?

  2. [15 p] Assume that a disk spins with speed 7200 rpm, it has one read/write head per surface, there are 2000 cylinders (tracks per surface), each track has 50 sectors, and sector size is 0.5 KB. Assume (unrealistically), that seek time (head transfer time) is linear to the number of tracks passed, and that it is 0.02 ms/track. Assume (unrealistically), that the location of each sector for one file is random, and from this one can deduce (with probability theory) that the average number of tracks passed is 667. Assume further (unrealistically), that the file is read from the disk one sector at a time. How long does it take, in average, to read one 333.33 KB file? What about 24 MB file?


  3. [15 p] Java programs (byte code) can be executed at least in three very different method. Explain for each method,
    1. how execution happens with that method?
    2. which process (processes) known by the operating system is executed when given Java program is in execution?
    3. an example on a situation where that method would be better than alternatives. Why?
    4. example on a situation where that method would be worse than alternatives. Why?
    5. would this method be better (than the alternative methods) for Java programming laboratory project? Why?


  4. [15 p]  Ttk-91 machine language. Integer valued variables  X and  I are defined on main program level. Integer valued table (array) T[100] is defined on main program level. Table T has thus 100 elements ( T[0], ..., T[99]). Records Rec1 and Rec2 of type typeRec={Id, Age, Salary} are allocated on main program level. The exact location for Rec1 and Rec2 are unknown (one can not  use symbols Rec1 and Rec2 in code), but pointer variables ptrRec1 and ptrRec2 (defined on main program level) contain their addresses. So, pointer variable ptrRec1 points to record Rec1. The record fields are stored in given order. Give in Ttk-91 symbolic assembly language (or in some other agreed upon similar language) instructions that, when executed, do the given tasks:
    1. [3 p] X = T[23];
    2. [3 p] X = T[I];                                  # assume (unrealistically) that value of I is in [0,99]
    3. [3 p] Clear table T, I.e., set all its elements to zero.
    4. [2 p] X = Rec1.Age;                          # field Age in Rec1, I.e., field Age in record pointed by ptrRec1
    5. [2 p] Rec1.Salary = Rec2.Salary;
    6. [2 p] Clear the record pointed by pointer variable ptrRec1, I.e., set all its fields to zero.



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