1. Please explain the following terminologies:
(a) Belady's anomaly (5%) (b) Convoy effect (5%) (c) Race condition (5%)
2. Answer the following questions briefly.
(a) Explain von Neumann architecture. (5%) (b) Explain the concept of RISC. (5%)
(c) Explain how the number of stage of a pipeline may affect its throughput without considering the effect of all kinds of hazards? (5%)
3. Given a classic processor that uses flat 16-bit address space and is equipped with 64KB main memory and 1KB 2-way set associative cache with each block being 4 words long (1 word = 16 bits).
(a) What is the bit length of the tag field in this cache? (10%)
(b) At least how many bytes are necessary to implement this cache? (5%) (c) If words of the following word addresses 15, 16, 1030, 103 1, 1032, 17,45,
46,4,5,260,6, 1030,103 1 are read into the processor one-by-one, how many times would this cache hit and miss? Assume that the cache is empty at the beginning. (5%)
4. Consider the following set of processes with the length of the CPU burst given in milliseconds:
(a) Draw five Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, preemptive SJF, preemptive priority (a smaller priority number implies a higher priority),
non-preemptive priority, and RR (quantum = 1). (10%) Process
f'1
, . p2 p3
P4
(b) What is the turnaround time of P4 for each of the five scheduling algorithms in part (a)? (5%)
(c) What is the waiting time of P3 for each of the five scheduling algorithms in part (a)? (5%)
Arrival Time 0 1 2 3
Burst Time 8 1 4 2
Priority 2 1 4 3
5 . Given a list of records
(Ro,
R1,. . ., R,1) and given the following six sorting methods: (A) bubble sort (B) quick sort (C) heap sort @) merge sort (E) radix sort Q insertion sort.
Note: Please answer the following questions by (A)(B)(C)(D)(E)(F) if possible.
(a) Explain what is "stable" property for sorting algorithm. (2%)
(b) Please list all the "stable" sorting algorithms among (A)(B)(C)(D)QQ.
(2%)
(c) Please list all sorting methods that have O(n log n) for time complexity in the "worst" case among (A)(B)(C)@)(E)(F). (2%)
6 . Consider the undirected graph shown below,
(a) Complete the (traditional) adjacency lists representation for this undirected graph. Arrange each adjacency list alphabetically. (3%)
(b) Please draw its depth-first search tree, starting at root node A (only show the discovery edges). Please consider the search path alphabetically. (3%) 7. Draw the final result after keys 5, 19,28, 15,20, 17, 10,33 are inserted into a
hash table wjth collisions resolved by (a) chaining (3%), (b) linear probing (3%).
Assume the table has eight slots with its address starts at 0, and let the hash function be h(k) = k mod 8.
8. Express the r d g time of each code fragment as a 8 function of n:
(a) (3%) (b) (3%)
for (a=l; a<=n; a++) for (a=l; a<=n; a++) for (b=l; b<=a; b++) for (b=l;b<=a; b*=2)
C++; C++;
(c) (3%) (d) (3%)
for (a=l; a<=n; a*=2) for (a=l; a<=n; a*=2) for ( b = l ; b<=a; b++) for (b=l; b<=a; b*=2)
C++; C++;