Hot answers tagged

109 votes
Accepted

Why is addition as fast as bit-wise operations in modern processors?

Addition is fast because CPU designers have put in the circuitry needed to make it fast. It does take significantly more gates than bitwise operations, but it is frequent enough that CPU designers ...
D.W.'s user avatar
  • 156k
58 votes

Is there anything that MUST be done on a multi-core CPU?

The question is: under what constraints? There are certainly problems where, if we ask the question "can we solve this problem on hardware X in the given amount of time", the answer will be no. But ...
jmite's user avatar
  • 29.7k
48 votes
Accepted

Is there anything that MUST be done on a multi-core CPU?

If you don't care about the running time, anything you can do on a multi-core machine, you can do on a single-core machine. A multi-core machine is just a way of speeding up some kinds of ...
D.W.'s user avatar
  • 156k
43 votes

Why is addition as fast as bit-wise operations in modern processors?

There are several aspects. The relative cost of a bitwise operation and an addition. A naive adder will have a gate-depth which depend linearly of the width of the word. There are alternative ...
AProgrammer's user avatar
  • 3,024
38 votes
Accepted

What does machine code actually look like while being run?

The best answer I can give is, it doesn't really "look" like anything. The instruction currently being executed by the CPU is represented by a series of wires, some of which have a high voltage, some ...
Draconis's user avatar
  • 7,048
37 votes
Accepted

What is a CPU clock physically?

Modern clocks are originally generated by quartz crystal oscillators of about 20MHz or so, and then the frequency is multiplied by one or more phase-locked loops to generate the clock signals for ...
user253751's user avatar
  • 1,720
30 votes
Accepted

What is a GPU year?

That means, one year of computation time on a single GPU (or half a year on two GPUs, or a quarter of a year on four GPUs, etc.). If you are thinking of using this term in your own writing, I ...
D.W.'s user avatar
  • 156k
29 votes
Accepted

How is conditional jump implemented in the CPU?

The problem: to define conditional jump we need a conditional jump? I mean in order to evaluate an IF the processor has to evaluate condition and IF it's true, then jump, otherwise not. It's an ...
harold's user avatar
  • 2,018
26 votes

Why is addition as fast as bit-wise operations in modern processors?

CPUs operate in cycles. At each cycle, something happens. Usually, an instruction takes more cycles to execute, but multiple instructions are executed at the same time, in different states. For ...
Paul92's user avatar
  • 528
17 votes

Is there anything that MUST be done on a multi-core CPU?

As other answers have pointed out, a single CPU can always emulate multiple CPUs by slicing time and playing the role of each virtual CPU. This emulation will certainly calculate the correct answers. ...
Nayuki's user avatar
  • 881
16 votes

What course in CS deals with the study of RAM, CPU, Storage?

The subject you're describing often goes under the names computer architecture, computer systems, computer organization and design, and the like. One example is Elements of computing systems, based on ...
Yuval Filmus's user avatar
13 votes

Why is addition as fast as bit-wise operations in modern processors?

Processors are clocked, so even if some instructions can clearly be done faster than others, they may well take the same number of cycles. You'll probably find that the circuitry required to ...
James Hollis's user avatar
12 votes

Why is addition as fast as bit-wise operations in modern processors?

Addition is important enough to not have it wait for a carry bit to ripple through a 64-bit accumulator: the term for that is a carry-lookahead adder and they are basically part of 8-bit CPUs (and ...
user72735's user avatar
  • 121
11 votes

What does machine code actually look like while being run?

"Look like" implies a metaphor. If we take "what will it look like" literally, it's going to look like a fancy etched piece of silicon sitting on its motherboard. Clearly metaphor was the goal. To ...
Cort Ammon's user avatar
  • 3,241
11 votes
Accepted

Are multiple interrupts generated when I hold down a key on my keyboard?

TL;DR: No. It depends on the OS and the keyboard. I'll show you how to determine this yourself on a Linux machine. I'm using Ubuntu 16.04 on an x86 processor. So if you are using a fairly modern ...
Hadi Brais's user avatar
11 votes

What does the program counter do?

Since this is a simple CPU, it's almost certainly to compute branch targets. Branch instructions typically represent the location to branch to as a small signed number to add to the program counter. ...
Pseudonym's user avatar
  • 21.7k
10 votes
Accepted

Would removing the branch delay slots change the instructions set architecture?

The instructions set architecture (ISA) is the contract between the hardware designer and the software designer. Anything that changes the contract, changes the ISA. The question you have to answer ...
Wandering Logic's user avatar
10 votes
Accepted

Why does the program counter increment before an instruction is completed?

The exact details of when (or even how) to increment the program counter are implementation specific details. There are however a few considerations that come into play across most computers. After ...
Peter Camilleri's user avatar
10 votes

Why is addition as fast as bit-wise operations in modern processors?

I think you'd be hard pressed to find a processor that had addition taking more cycles than a bitwise operation. Partly because most processors must carry out at least one addition per instruction ...
pjc50's user avatar
  • 411
10 votes
Accepted

What is instruction throughput and instruction latency?

Latency = time from the start of the instruction until the result is available. If your division has a latency of 26 cycles, and you calculate (((x / a) / b) / c), then the result of the division by a ...
gnasher729's user avatar
  • 28.4k
10 votes

What does machine code actually look like while being run?

Check out this video, in particular 1:00 to 1:17. That's exactly what it looks like when a program is running on a computer. The two rows of lights show the current contents of the address register ...
JavaLatte's user avatar
  • 211
9 votes

A multi-user, multi-processing operating system cannot be implemented on hardware that does not support

I remember a counter-example from the 1980s: OS-9/68000 was quite popular then: a multi-user, multi-processing real-time operating system for the Motorola 68K processor family, loosely patterned ...
R. Kleberhoff's user avatar
9 votes

Why is addition as fast as bit-wise operations in modern processors?

At the gate level, you are correct that it takes more work to do addition, and thus takes longer. However, that cost is sufficiently trivial that doesn't matter. Modern processors are clocked. You ...
Cort Ammon's user avatar
  • 3,241
9 votes
Accepted

Why doesn't playing audio stop other tasks?

Since the CPU works in fixed clock cycles, nothing is really continuous, only seems so because the discretization is sensitive enough. Suppose your CPU clock rate is $1\text{GHz}=10^9Hz$. If the CPU ...
Ariel's user avatar
  • 13.3k
9 votes

Why doesn't playing audio stop other tasks?

40 years ago, you might have had a computer where the CPU controlled the speaker directly. Those times are over, long ago. You may have a computer with a primitive sound card. Such a sound card will ...
gnasher729's user avatar
  • 28.4k
9 votes
Accepted

Does overclocking a cpu speed up a poorly optimised process?

Optimization is not really something that should be guessed at. Instead you need to measure what is going on to determine the chokepoints and where changes need to be made. A faster processor may ...
Richard Chambers's user avatar
8 votes

Is there anything that MUST be done on a multi-core CPU?

It's much harder to develop really nefarious data races with a single CPU. I mean, sure, you can pull off tearing between words if you interrupt a single CPU, but can you build exotic scenarios where ...
Cort Ammon's user avatar
  • 3,241
8 votes
Accepted

Where does the CPU get its first instructions from?

1. (A summary of the answer-in-comments by Jukka) Startup code is stored in ROM (non-volatile memory) at a fixed address X. When you activate the "reset" signal in the CPU, the CPU will initialise ...
Ran G.'s user avatar
  • 20.6k
8 votes

Does CPU without register exist?

Every CPU has, at the very least, some internal registers: a program counter, a register storing flags, and in some architectures, an accumulator (though the latter isn't strictly required). As you ...
Yuval Filmus's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible