Dayaan M. answered 1d
Computer Science Graduate with Computer Engineering Coursework
A flowchart only uses a few shapes, and once you know which step maps to which shape this one basically draws itself. A rectangle is a process step, meaning something just happens. A diamond is a decision, meaning the flow splits into a yes path and a no path. An oval is a terminator, your start and your stop. Every step in your list is either a rectangle or a diamond, and only steps 5 and 6 are diamonds, since those are the only two that ask a question.
Here is the whole flow laid out:
START
|
v
[Store first memory location of program in base register]
|
v
[Set program counter = address of first memory location]
|
v
[Read first instruction of the program]
|
v
[Increment program counter by number of bytes in instruction] <---+
| |
v |
< Last instruction reached? > --- YES ---> (STOP loading) |
| |
NO |
| |
v |
< Program counter > memory size? > --- YES ---> (STOP loading) |
| |
NO |
| |
v |
[Load instruction in memory] |
| |
v |
[Read next instruction of the program] |
| |
+----------------------------------------------------+
step 9: go back to step 4
That arrow running from step 8 back up to step 4 is the loop, and it is the piece people leave off most often. Step 9 is not a box of its own, it is only that arrow.
Remember, the purpose of this scheme is that one single user program owns all of memory at once, so the two diamonds are doing two different jobs and it is worth being clear on which is which. Step 5 is the ordinary end of job check, asking whether we simply ran out of program to load. Step 6 is the memory protection check, asking whether the program has grown past the memory we actually have. That is also why step 1 stores the base register before anything else. In a single user contiguous system the only protection you need is knowing where the program starts and how far it is allowed to reach, and if it runs past that you stop instead of letting it write over the operating system.
If it helps to see the same logic as code, the diagram is just a loop with two exit conditions:
pc = base_register
instr = read_first_instruction()
while True:
pc = pc + length_in_bytes(instr)
if last_instruction_reached():
break
if pc > memory_size:
break
load_into_memory(instr)
instr = read_next_instruction()
So our final diagram is one start oval, six rectangles, two diamonds, two stop ovals, and the one arrow that carries step 8 back to step 4.