









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: Operating Systems; Subject: Computer Programming; University: University of Central Florida; Term: Spring 2009;
Typology: Assignments
1 / 15
This page cannot be seen from the preview
Don't miss anything!










Binary Opcode Instruction Semantics 0001 Load AC from memory address 0010 Store AC to memory address 0011 Load AC from I/O device 0100 Right shift AC 1 bit 0101 Add to AC from memory address 0110 Multiply to AC from memory address 0111 Store AC to I/O device
For instructions that access I/O devices, they I/O device is treated similar to memory in that the 12-bit address identifies a particular external device. Using a technique similar to that used in the notes, show the step-by-step execution of the following program. All addresses are given in hexadecimal. Assume the following:
The program in hexadecimal: 3005 5840 7006 1841 4000 5840 2842
Initial memory initial CPU registers ADDRESS (in hex)
(in hex) 300 3005 301 5840 302 7006 303 1841 304 4000 305 5840 306 2842
...... 840 000E 841 000B 842?
(in hex) PC?
AC?
IR?
(in hex)
(in hex) 5 0003 6?
Initial device values
Instruction #2: Add contents of address 840: (5840) 16 = (0101 1000 0100 0000) 2
FETCH/DECODE STEP:
Initial memory initial CPU registers
Initial memory initial CPU registers
(in hex)
(in hex) 300 3005 301 5840 302 7006 303 1841 304 4000 305 5840 306 2842
...... 840 000E 841 000B 842?
(in hex) PC 301
AC 0003
IR 5840
(in hex)
(in hex) 5 0003 6?
(in hex)
(in hex) 300 3005 301 5840 302 7006 303 1841 304 4000 305 5840 306 2842
...... 840 000E 841 000B 842?
(in hex) PC 302
AC 0011
IR 5840
(in hex)
(in hex) 5 0003 6?
Initial device values
Initial device values
Instruction #3: Store AC to device 6: (7006) 16 = (0111 0000 0000 0110) 2
FETCH/DECODE STEP:
Initial memory initial CPU registers
Initial memory initial CPU registers
(in hex)
(in hex) 300 3005 301 5840 302 7006 303 1841 304 4000 305 5840 306 2842
...... 840 000E 841 000B 842?
(in hex) PC 302
AC 0011
IR 7006
(in hex)
(in hex) 5 0003 6?
(in hex)
(in hex) 300 3005 301 5840 302 7006 303 1841 304 4000 305 5840 306 2842
...... 840 000E 841 000B 842?
(in hex) PC 303
AC 0011
IR 7006
(in hex)
(in hex) 5 0003 6 0011
Initial device values
Initial device values
Instruction #5: Right Shift AC: (4000) 16 = (0100 0000 0000 0000) 2
FETCH/DECODE STEP:
Initial memory initial CPU registers
Initial memory initial CPU registers
(in hex)
(in hex) 300 3005 301 5840 302 7006 303 1841 304 4000 305 5840 306 2842
...... 840 000E 841 000B 842?
(in hex) PC 304
AC 000B
IR 4000
(in hex)
(in hex) 5 0003 6 0011
(in hex)
(in hex) 300 3005 301 5840 302 7006 303 1841 304 4000 305 5840 306 2842
...... 840 000E 841 000B 842?
(in hex) PC 305
AC 0005
IR 4000
(in hex)
(in hex) 5 0003 6 0011
Initial device values
Initial device values
Instruction #6: Add AC from address 840: (5840) 16 = (0101 1000 0100 0000) 2
FETCH/DECODE STEP:
Initial memory initial CPU registers
Initial memory initial CPU registers
(in hex)
(in hex) 300 3005 301 5840 302 7006 303 1841 304 4000 305 5840 306 2842
...... 840 000E 841 000B 842?
(in hex) PC 305
AC 0005
IR 5840
(in hex)
(in hex) 5 0003 6 0011
(in hex)
(in hex) 300 3005 301 5840 302 7006 303 1841 304 4000 305 5840 306 2842
...... 840 000E 841 000B 842?
(in hex) PC 306
AC 0013
IR 5840
(in hex)
(in hex) 5 0003 6 0011
Initial device values
Initial device values
What is the average time in nanoseconds required to access a referenced word on this computer?
There are three cases to consider:
Location of the referenced word
Probability Total time for access in nanoseconds In cache 0.9 20ns Not in cache, but in main memory (0.1)(0.6) = 0.06^ 60ns + 20ns = 80ns Not in cache and not in main memory (0.1)(0.4) = 0.04^ 12ms + 60ns + 20ns = 12,000,080ns
So the average access time would be:
= (0.9)(20ns) + (0.06)(80ns) + (0.04)(12000080ns) = 480,026ns
Process Arrival Time Processing Time A 0 3 B 1 5 C 3 2 D 9 5 E 12 5
For each of the scheduling protocols of (a) FCFS, (b) Round-Robin (do for both time- quantum = 1 and time quantum = 2), (c) Shortest Process Next, (d) Shortest Remaining Time, (e) HRRN, and (f) Feedback (time-quantum = 1) do the following:
RR (quantum = 2) Gantt chart:
A B C D E
Timing Process Waiting Time Tr Tr/Ts A 4 7 7/3 = 2. B 6 11 11/5 = 2. C 1 3 3/ 1 = 3 D 5 10 10/5 = 2 E 4 8 8/ 4 = 2
Mean 20/5 = 4 39/5 = 7.8 11.53/5 = 2. 306
(c) SPN Gantt chart:
Timing
Process Waiting Time Tr Tr/Ts
A 0 3 3/3 = 1 B 4 9 9/5 = 1. C 0 2 2/2 = 1 D 1 6 6/5 = 1. E 3 8 8/5 = 1. Mean 8/5 = 1.6 28/5 = 5.6 6.6/5 = 1.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
(d) SRT Gantt chart A B C D E
Timing Process Waiting Time Tr Tr/Ts
A 0 3 3/3 = 1 B 4 9 9/5 = 1. C 0 2 2 /2 = 1 D 1 6 6/5 = 1. E 3 8 8/5 = 1. Mean 8/5 = 1.6 28/5 = 5.6 6.6/5 = 1. 32
(e) HRRN (assume FCFS in event of tie on HRR) Gantt chart A B C D E
Timing Process Waiting Time Tr Tr/Ts A 0 3 3/3 = 1 B 2 7 7/5 = 1. C 5 7 7/2 = 3. D 1 6 6/5 = 1. E 3 8 8/5 = 1. Mean 11/5 = 2.2 31/5 = 6.2 8.7/5 = 1.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20