Questions tagged [cpu]

CPU is the abbreviation for central processing unit. Sometimes referred to simply as the central processor, but more commonly called processor

CPU is the abbreviation for central processing unit. Sometimes referred to simply as the central processor, but more commonly called processor, the CPU is the brains of the computer where most calculations take place. In terms of computing power, the CPU is the most important element of a computer system.

122 questions
73
votes
3 answers

How does a single thread run on multiple cores?

I am trying to understand, at a high-level, how single threads run across multiple cores. Below is my best understanding. I do not believe it is correct though. Based on my reading of Hyper-threading, it seems the OS organizes the instructions of…
Evorlor
  • 1,440
  • 2
  • 16
  • 22
68
votes
3 answers

Which programming language is used to write a BIOS program?

As I understand, the BIOS code/bitstream that is held in the ROM should be generic (work alongside with multiple CPU types or ISAs). In addition, I saw mentioned on the web that it is possible to dump its code (and to "disassemble" it). So, in which…
Reflection
  • 769
  • 1
  • 6
  • 6
65
votes
7 answers

Is a 1 < 10 comparison less expensive than 1 < 1000000?

I just used ~1 billion as the count for a z-index in CSS, and was thinking about the comparisons that must go on. Is there a difference in performance on the ALU level in comparisons between very large numbers vs very small ones? For example, would…
J.Todd
  • 3,833
  • 5
  • 22
  • 27
61
votes
10 answers

Does it ever make sense to use more concurrent processes than processor cores?

I've got some process in Go. Here's an example counting lines in text, though the question is meant to be far more general than this particular example: func lineCount(s string) int { count := 0 for _, c := range s { if c == '\n' { …
TheEnvironmentalist
  • 1,159
  • 1
  • 8
  • 14
55
votes
12 answers

Why would a program require a specific minimum number of CPU cores?

Is it possible to write code (or complete software, rather than a piece of code) that won't work properly when run on a CPU that has less than N number of cores? Without checking it explicitly and failing on purpose: IF (noOfCores < 4) THEN don't…
uylmz
  • 1,129
  • 1
  • 8
  • 17
43
votes
7 answers

In software programming, would it be possible to have both CPU and GPU loads at 100%?

This is a general question on a subject I've found interesting as a gamer: CPU/GPU bottlenecks and programming. If I'm not mistaken, I've come to understand that both CPU and GPU calculate stuff, but that one is better in some calculations than the…
Azami
  • 549
  • 4
  • 8
43
votes
10 answers

Why should your code not use 100% CPU?

I'm speaking specifically about a C# .NET 4 program running on Windows XP or higher, but general answers are also acceptable. Assume an already optimized and efficient program. The problem here is entirely down to effects of high CPU usage on…
Nick Udell
  • 1,214
  • 2
  • 11
  • 17
41
votes
3 answers

Why does the stack grow downward?

I'm assuming there's a history to it, but why does the stack grow downward? It seems to me like buffer overflows would be a lot harder to exploit if the stack grew upward...
user541686
  • 8,074
  • 8
  • 38
  • 49
33
votes
7 answers

Why do modern operating systems *ever* have perceptible input (keyboard/mouse) lag?

Sometimes computers stutter a bit when they're working hard, to the point where the mouse location freezes for a fraction of a second, or stutters intermittently for a few seconds. This sometimes happens with keyboard input too, even in very basic…
32
votes
4 answers

What are CPU registers?

This question has been bothering me for some time now and today I figured I would Google it. I've read some stuff about it and it seemed very similar to what I've always known as processor cache. Is there a difference between the two or am I right…
Jeroen
  • 613
  • 1
  • 7
  • 13
32
votes
1 answer

Performance of single-assignment ADT oriented code on modern CPUs

Working in immutable data with single assignments has the obvious effect of requiring more memory, one would presume, because you're constantly creating new values (though compilers under the covers do pointer tricks to make this less of an…
Jimmy Hoffa
  • 16,039
  • 3
  • 69
  • 80
30
votes
6 answers

Why do we have to wait for I/O?

It's always been known that Disk operations are slow and we know the reasons why they are slow. So the question here is why do we have to wait for I/O or why is there such a thing as IOWait, etc.? I mean I've noticed that when you're doing some I/O…
Arturas M
  • 551
  • 1
  • 6
  • 10
29
votes
2 answers

How does sleeping a thread work?

When you sleep a thread, what is actually going on? I see that sleeping a thread "pauses the current thread for a given period of time". But just how does it work? According to How Thread.sleep() works internally and How does Thread.sleep really…
Rowan Freeman
  • 3,478
  • 4
  • 30
  • 41
26
votes
3 answers

Why are there separate L1 caches for data and instructions?

Just went over some slides and noticed that the L1 cache (at least on Intel CPUs) distinguishes between data and instruction cache, I would like to know why this is..
Nils
  • 556
  • 2
  • 5
  • 13
26
votes
6 answers

How often do CPUs make calculation errors?

In Dijkstra's Notes on Structured Programming he talks a lot about the provability of computer programs as abstract entities. As a corollary, he remarks how testing isn't enough. E.g., he points out the fact that it would be impossible to test a…
veryfoolish
  • 897
  • 1
  • 6
  • 12
1
2 3
8 9