Tutorial 4: Software

Note

This is for practice, not for marks. Treat this as additional study material to help you develop your knowledge and skills on these topics. During the tutorial session, the TA will explain how to solve these problems.

For this tutorial, we will use basic RISC operations as seen in the Lecture 1 (Computer Technology and Abstractions), slides 69–79.

Question 1

This question is about ARM instruction encoding. Recall that the machine language instruction are encoded as a binary of 32 bits per instruction.

../_images/instruction_encoding.png

For The following instructions, find their binary encoding. In each case find the binary value of Cond:, I, S, Rn, Rd and Operand2. Note that each of these instructions are independent.

  1. SUB  R3, R4, #10

  2. SUBLTS R1, R2, R3

  3. LDR R4, [R4], R5

  4. LDR R3, [R4,#6]

Question 2

Given the following arm assembly program, produce the Object Program Memory Map and Symbol Table

.global _start



_start:
        MOV R1, #5
LOOP1:
        ADD R1, #1
        CMP R1, #10
        BNE LOOP1
LOOP2:
        SUB R1, #4
.end

Question 3

../_images/fig_4_7.png

The figure shows the input/output steps of a program which can be overlapped to reduce the total time needed to execute them. Let each of the six OS routine execution intervals be 1 unit of time, with each disk operation requiring 3 units, printing requiring 3 units, and each program execution interval requiring 2 units.

  • How long does the execution of one such program takes?

  • Let’s assume that operating system can schedule the concurrent execution of many programs perfectly so as to maximize the system throughout. What is the total time required to execute two identical copies of the program, assuming there is only one printer, one disk and one CPU?

  • What if there are two CPU but still a single printer and disk?