The Abstraction: The Process

Homework (Simulation)

This program, process-run.py, allows you to see how process states change as programs run and either use the CPU (e.g., perform an add instruction) or do I/O (e.g., send a request to a disk and wait for it to complete). See the README for details.

Target

The Abstraction: The Process

Introduction

type python process-run.py -h in the command, you should see:

The Abstraction: The Process
The Abstraction: The Process
The Abstraction: The Process

Question & Answer

1

The Abstraction: The Process

The Abstraction: The Process
The CPU utilization is 100%.

The Abstraction: The Process

2

The Abstraction: The Process
The Abstraction: The Process
It takes 10 clock ticks to complete both processes.

The Abstraction: The Process
First, process 0 was run, it took 4 clock ticks. Then process 1 issued an I/0 request, the CPU received and blocked process 1, it took 1 clock tick. Next the I/O took 4 clock ticks, and finally the CPU unblocked the process 1, process 1 was done, it took 1 clock tick.

3

The Abstraction: The Process
The Abstraction: The Process
The Abstraction: The Process
Process 0 issued an I/O request, the CPU blocked it and started I/O operations, it took 1 clock tick. When I/Os were running, process 1 issued the CPU request, after 4 clock ticks, I/Os and CPU finished. It takes a total of 6 clock ticks.

4

The Abstraction: The Process
The Abstraction: The Process
When process 0 is doing I/0, the system will not switch to process 1, instead waiting until the process 0 is completely finished.

5

The Abstraction: The Process
The Abstraction: The Process
It is the same as question 3.

6

The Abstraction: The Process
The Abstraction: The Process
The system resources are not being effectively utilized.

7

The Abstraction: The Process
The Abstraction: The Process
The difference between the two is whether the CPU accepts the next I/O request or runs the process instruction after the I/O operation is executed. Since the default mode SWITCH_ON_IO is adopted, the CPU executes instructions and I/O operations are performed simultaneously, so IO_RUN_IMMEDIATE is 1 clock tick faster.