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
20
votes
1 answer

Instruction Pointer vs Program Counter?

Is there any basic difference between instruction pointer and program counter? I believe they both refer to the same thing, the eip/rip register, although with the research i have done so far it is not very clear in my mind.
20
votes
1 answer

Get results of GPU calculations back to the CPU program in OpenGL

Is there a way to get results from a shader running on a GPU back to the program running on the CPU? I want to generate a polygon mesh from simple voxel data based on a computational costly algorithm on the GPU but I need the result on the CPU for…
danijar
  • 32,406
  • 45
  • 166
  • 297
20
votes
1 answer

context switch vs memory access, which is faster?

Got asked in an interview. They asked to order the following in terms of speed: CPU register access, Context switch Memory access Disk seek. pretty sure the disk seek is the slowest and register access is the fastest, but not quite sure about…
Wudong
  • 2,320
  • 2
  • 32
  • 46
19
votes
3 answers

Does GRUB switch to protected mode?

I would like to ask if it is GRUB that switch the CPU to protected mode during boot up or is it the Linux kernel that does it. And also I would like to ask - is the kernel itself (vmlinuz) an ELF or is it plain binary format? Thanks.
mnc
  • 199
  • 1
  • 3
19
votes
7 answers

What is the smallest, simplest CPU that GCC can compile for?

In terms of instruction set and simplicity of emulation. I would like to implement a virtual CPU and figured why not emulate an existing one, so to be able to compile C code to it.
Tamás Szelei
  • 23,169
  • 18
  • 105
  • 180
19
votes
5 answers

Estimating process energy usage on PCs (x86)

I'm trying to come up with a heuristic to estimate how much energy (say, in Joules) a process or a thread has consumed between two time points. This is on a PC (Linux/x86), not mobile, so the statistics will be used to compare the relative energy…
Eitan
  • 862
  • 1
  • 7
  • 17
19
votes
2 answers

When using htop command, do red values in the time+ column mean there's something wrong?

Below is my server htop display. The nginx process uses CPU time more then 18 hours, and is shown in red color, but CPU and memory all look OK. Is the value within the normal range?
artwl
  • 3,502
  • 6
  • 38
  • 53
19
votes
3 answers

C linux equivalent of windows QueryPerformanceCounter

Is there an equivalent C function in linux for reading the CPU counter and its frequency? I am looking for something similair to QueryPerformanceCounter function that reads the 64bit counter in modern CPU's
myforwik
  • 191
  • 1
  • 1
  • 4
19
votes
2 answers

Timing the CPU time of a python program?

I would like to time a snippet of my code, and I would like just the CPU execution time (ignoring operating system processes etc). I've tried time.clock(), it appears too imprecise, and gives a different answer each time. (In theory surely if I run…
Nathan Bush
  • 1,401
  • 4
  • 13
  • 17
18
votes
10 answers

Assembly CPU frequency measuring algorithm

What are the common algorithms being used to measure the processor frequency?
Sergey Kivanov
18
votes
4 answers

How are interrupts handled by dual processor machines?

I have an idea of how interrupts are handled by a dual core CPU. I was wondering about how interrupt handling is implemented on a board with more than one physical processor. Is any of the interrupt responsibility determined by the physical…
jeffD
  • 1,230
  • 3
  • 13
  • 18
18
votes
5 answers

List of OpenCL compliant CPU/GPU

How can I know which CPU can be programmed by OpenCL? For example, the Pentium E5200. Is there a way to know w/o running and querying it?
Lior Dagan
  • 189
  • 1
  • 1
  • 3
18
votes
3 answers

How was the first computer program created?

Possible Duplicate: How was the first compiler written? This question has always been bothering me. To compile a program, you need a compiler, which is also a type of program, so what compiled the compiler? Somebody told me that the first…
user577304
18
votes
7 answers

Can't enable multiple CPU on VirtualBox

I would like to use more than one CPU to run Ubuntu 14.04 (Trusty Tahr) 32-bit in VirtualBox, but when I stop the machine and go in Settings → System → Processor, the processor(s) slider is grayed out as you can see in the screenshot image. How can…
Guillaume.P
  • 421
  • 1
  • 4
  • 12
18
votes
1 answer

AWS EC2: The number of cpu cores available on an instance

I have recently set up an instance (m4.4xlarge). when I execute 'lscpu' command, the output looks something like the following: CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 16 On-line CPU(s) list:…
d-_-b
  • 4,142
  • 6
  • 28
  • 43