23. How do clocks impact computing?

23.1. Recall our model Computer

von Neumann Architecture

We have talked about the ALU at length and we have touched on memory, but next we will start to focus on the Control unit.

We discussed that the operations we need to carry out is mostly

23.2. Control Unit

The control unit converts binary instructions to signals and timing to direct the other components.

23.2.1. What signals?

We will go to the ALU again since the control unit serves it to figure out what it needs.
Remember in the ALU, has input signals that determine which calculation it will execute based on the input.

23.2.2. Why Timing signals?

Again, the ALU itself tells us why we need this, we saw that different calculations the ALU does take different amount of times to propagate through the circuit.

Even adding numbers of different numbers that require different number of carries can take different amount of times.

So the control unit waits an amount of time, that’s longer than the slowest calculation before sending the next instruction. It also has to wait that long before reading the output of the ALU and sending that result to memory as needed.

23.3. What is a clock?

In a computer the clock refers to a clock signal, historically this was called a logic beat. This is represented by a sinusoidal (sine wave) or square (on, off, on, off) signal that operates with a constant frequency.

This has changed a lot over time.

The first mechanical analog computer, the Z1 operated at 1 Hz, or one cycle per second; its most direct successor moved up to 5-10Hz; later there were computers at 100kHz or 100,000Hz, but where one instruction took 20 cycles, so it had an effective rate at 5kHz.

Try it Yourself

Look up the CPU speed of your computer and your phone. How do they compare.

23.4. Execution Times

time kwlfilecheck

We get three times:

  • real: wall clock time, the total time that you wait for the the process to execute

  • user: CPU time in user mode within the the process, the time the CPU spends executing the process itself

  • sys: CPU time spent in the kernel within the process, the time CPU spends doing operating system interactions associated with the process

The real time includes the user time, the system time, and any scheduling or waiting time that that occurs.

23.5. Prepare for next class

  1. Check that your KWL is up to date with all required rows and add a section (##) below your chart in the same file (either README or chart.md) that summarizes what you think about computer systems.

  2. (priorty) Read about systems vs applications programming. Create systemsprogramming.md to summarize the difference and what skills would be diffrent. Which do you have more experience with? What experience do you have with the other? (we will address this in class Thursday)

23.6. More Practice

  1. (priority) Compare the time of the following operations, investigate what the different operations do/not do, how do the three times compare? and hypothesize explanations in timing.md. Which times are constant vs variable? Which vary the most? least? Tip: use a script with loops and see the optionsand write output to a file (to test how these impact your work. extension idea: expand the level of detail to include more analysis on this, Try to find operations that increase the user vs system time. You can use basic bash operations or programs you have from other courses )

    1. wget https://github.com/introcompsys/spring2022/blob/main/img/2022-01-27-mental_model_advanced.svg
    2. wget https://raw.githubusercontent.com/introcompsys/spring2022/main/img/2022-01-27-mental_model_advanced.svg
    3. kwlcheck
    4. kwlfilecheck
    5. hello world compiled from C
    
  2. Practice exploring the list of processes running on your computer and investigate how much resources different things you do on a regular basis use. Make some general observations In kernelproc.md.

23.7. Questions After Class

23.7.1. where are the registers?

The registers are a part of the CPU.

23.7.2. Is there a model of CPU without an ALU?

The term CPU specifically refers to combining an ALU with a control unit and registers. Modern CPUs use integrated circuits, so multiple components are etched into silicone instead of having separate components that are, for example, soldered onto a board.

23.7.3. What is a core

A core is an execution unit: a control unit, an ALU, and the necessary registers. Traditionally a CPU had one core, so the model CPU we saw is the same as a core. A modern, multi-core CPU has multiple execution units and additional circuitry to coordinate.

23.7.4. Will we get time in class this week / next week to use as like a workshop to finish things we need to with help from you?

This is what office hours are for. I added more office hours, the link to the times are in slack and will be shared in class.

Please, please! come to office hours or ask for an additional appointment.

23.7.5. Why do the different times matter?

the different times demonstrate different parts of what has to happen, there is scheduling and waiting; there is the actual executing and there are kernel (OS) steps.

23.7.6. What are the side effects of overclocking the computer?

It gets hotter, so that it causes more stress and strain on the

23.7.7. Is there a good intro to this stuff online? Or will we go over it in 411?

More detail on this will be in 411 and the OS/ process side will be in 412.

23.7.8. What are the pieces of a kernel and what does it actually do for the computer?

The kernel is software, not a physical component.