Specialty Digest

Global English editionLearners’ Study Dashboard — in development
The Knowledge Library for All

Online Courses / University Track / Computing Foundations

Module 7 · Lab

Lab: trace a program, size storage and share a processor

Trace and write toy-machine programs, estimate storage and explain time sharing.

  • 50 minutes
  • 14 marks
  • Self-marked

50 minutes. Self-marked against the rubric. 14 marks. In the full course this counts toward the labs and cases share (15% of the course grade). Write your answers in the boxes, then open the model answer and tick each mark you earned honestly. Nothing is sent or stored.

Scenario (invented)

A small workshop (invented) is choosing a basic device for its office. Use the toy machine of Lesson 3 (LOAD, ADD, SUB, STORE) and decimal units. The device has 128 GB of storage; the workshop’s scans are 4 MB each.

Tasks

Task 1 (3 marks)

Trace LOAD 10, SUB 4, ADD 7, STORE 2. Give the accumulator after each step and the final contents of address 2.

Private: nothing you type here is sent or stored.

Task 2 (4 marks)

Write a toy-machine program that works out 8 + 5 − 3 and stores the result at address 1. State the result.

Private: nothing you type here is sent or stored.

Task 3 (4 marks)

How many 4 MB scans fit in 128 GB? Show the unit conversion. Then say what the OS must do to keep them safe from other users.

Private: nothing you type here is sent or stored.

Task 4 (3 marks)

Five programs share one processor with 4 ms turns (invented). How often does each program get a turn, and why do they seem to run at once?

Private: nothing you type here is sent or stored.

Rubric and model answer

Task 1: trace (3 marks)

Model: after LOAD 10: 10. After SUB 4: 6. After ADD 7: 13. STORE 2: address 2 holds 13.

Task 2: write (4 marks)

Model: LOAD 8; ADD 5; SUB 3; STORE 1. Result: 10 stored at address 1.

Task 3: storage (4 marks)

Model: 128 GB = 128,000 MB; 128,000 ÷ 4 = 32,000 scans. The OS uses file permissions so that only allowed users can read or change them.

Task 4: time sharing (3 marks)

Model: one rotation takes 5 × 4 = 20 ms, so each program runs every 20 ms. The turns are so short that the programs seem continuous.

Marks so far: 0 of 14