Questions tagged [cpu]

The central processing unit or "processor" inside a computer which executes the instructions in a computer program.

The central processing unit (CPU) is the portion of a computer system that carries out the instructions of a computer program, and is the primary element carrying out the computer's functions. The central processing unit carries out each instruction of the program in sequence, to perform the basic arithmetical, logical, and input/output operations of the system. This term has been in use in the computer industry at least since the early 1960s. The form, design and implementation of CPUs have changed dramatically since the earliest examples, but their fundamental operation remains much the same.

Source: Wikipedia

4662 questions
48
votes
3 answers

How to enable support of CPU virtualization on Macbook Pro?

I have the VirtualBox installed on my Macbook Pro, and I want to install a linux VM on VirtualBox. When I launched the new VM, it prompts that "Your CPU does not support long mode. Use a 32bit distribution." After searching for this problem, I…
David Wu
  • 711
  • 2
  • 7
  • 9
47
votes
3 answers

Kubernetes CPU multithreading

I have a 4 cores CPU, I create a Kubernetes Pod with CPU resource limit 100m, which mean it will occupy 1/10 of a core power. I wondering in this case, 100m is not even a full core, if my app is a multithread app, will my app's threads run in…
Sam YC
  • 10,725
  • 19
  • 102
  • 158
47
votes
1 answer

Why do we use CPUs for ray tracing instead of GPUs?

After doing some research on rasterisation and ray tracing. I have discovered that there is not much information on how CPUs work for ray-tracing available on the internet. I came across and article about Pixar and how they pre-rendered Cars 2 on…
oodle600
  • 619
  • 1
  • 5
  • 8
44
votes
7 answers

Is bit shifting O(1) or O(n)?

Are shift operations O(1) or O(n) ? Does it make sense that computers generally require more operations to shift 31 places instead of shifting 1 place? Or does it make sense the number of operations required for shifting is constant regardless of…
Pacerier
  • 86,231
  • 106
  • 366
  • 634
44
votes
9 answers

Throttling CPU/Memory usage of a Thread in Java?

I'm writing an application that will have multiple threads running, and want to throttle the CPU/memory usage of those threads. There is a similar question for C++, but I want to try and avoid using C++ and JNI if possible. I realize this might not…
Alex Beardsley
  • 20,988
  • 15
  • 52
  • 67
42
votes
9 answers

How to write super-fast file-streaming code in C#?

I have to split a huge file into many smaller files. Each of the destination files is defined by an offset and length as the number of bytes. I'm using the following code: private void copy(string srcFile, string dstFile, int offset, int length) { …
ala
  • 7,070
  • 13
  • 47
  • 54
42
votes
4 answers

How does cpu communicate with peripherals?

i assume cpu has direct access to motherboard's BIOS and RAM.(correct me if i'm wrong) But how does cpu communicate with other hardware like hdds, expansion cards, peripherals, other BIOSes etc.? I know about OS and its drivers, but they are…
DrStrangeLove
  • 11,227
  • 16
  • 59
  • 72
41
votes
2 answers

CPU SIMD vs GPU SIMD?

GPU uses the SIMD paradigm, that is, the same portion of code will be executed in parallel, and applied to various elements of a data set. However, CPU also uses SIMD, and provide instruction-level parallelism. For example, as far as I know,…
Carmellose
  • 4,815
  • 10
  • 38
  • 56
41
votes
3 answers

What does 'bank'ing a register mean?

Reading 'ARM Architecture' on Wikipedia and found the following statement: Registers R0-R7 are the same across all CPU modes; they are never banked. R13 and R14 are banked across all privileged CPU modes except system mode. What does banking a…
lang2
  • 11,433
  • 18
  • 83
  • 133
40
votes
5 answers

Can a C# program measure its own CPU usage somehow?

I am working on a background program that will be running for a long time, and I have a external logging program (SmartInspect) that I want to feed with some values periodically, to monitor it in realtime when debugging. I know I can simply fire up…
Lasse V. Karlsen
  • 380,855
  • 102
  • 628
  • 825
38
votes
12 answers

What is faster (x < 0) or (x == -1)?

Variable x is int with possible values: -1, 0, 1, 2, 3. Which expression will be faster (in CPU ticks): 1. (x < 0) 2. (x == -1) Language: C/C++, but I suppose all other languages will have the same. P.S. I personally think that answer is (x <…
Nikolay Vyahhi
  • 1,432
  • 1
  • 16
  • 30
38
votes
1 answer

How has CPU architecture evolution affected virtual function call performance?

Years ago I was learning about x86 assembler, CPU pipelining, cache misses, branch prediction, and all that jazz. It was a tale of two halves. I read about all the wonderful advantages of the lengthy pipelines in the processor viz instruction…
spraff
  • 32,570
  • 22
  • 121
  • 229
37
votes
6 answers

Finding out the CPU clock frequency (per core, per processor)

Programs like CPUz are very good at giving in depth information about the system (bus speed, memory timings, etc.) However, is there a programmatic way of calculating the per core (and per processor, in multi processor systems with multiple cores…
kidoman
  • 2,402
  • 5
  • 26
  • 35
37
votes
7 answers

What are the advantages of a 64-bit processor?

Obviously, a 64-bit processor has a 64-bit address space, so you have more than 4 GB of RAM at your disposal. Does compiling the same program as 64-bit and running on a 64-bit CPU have any other advantages that might actually benefit programs that…
Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477
36
votes
6 answers

Command to find information about CPUs on a UNIX machine

Do you know if there is a UNIX command that will tell me what the CPU configuration for my Sun OS UNIX machine is? I am also trying to determine the memory configuration. Is there a UNIX command that will tell me that?
Peter Delaney
  • 5,278
  • 9
  • 33
  • 40