Questions tagged [cpu]

The CPU (Central Processing Unit), is the chip in the computer that actually performs the operations and calculations that are done as a program runs. It is essentially what executes a program.

Use of this tag should be limited to general questions regarding:

  • the specific features and/or capabilities of a CPU
  • commands that can interact with the CPU to display its features
  • commands that show how many CPUs are present
  • show its model/type
  • can reconfigure it
820 questions
340
votes
12 answers

How to know number of cores of a system in Linux?

I wanted to find out how many cores my system has, so I searched the same question in Google. I got some commands such as the lscpu command. When I tried this command, it gave me the following result: $ lscpu Architecture: x86_64 CPU…
Mr ASquare
  • 3,605
  • 4
  • 12
  • 11
269
votes
6 answers

What do the flags in /proc/cpuinfo mean?

How can I tell whether my processor has a particular feature? (64-bit instruction set, hardware-assisted virtualization, cryptographic accelerators, etc.) I know that the file /proc/cpuinfo contains this information, in the flags line, but what do…
Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
256
votes
3 answers

Linux "top" command: What are us, sy, ni, id, wa, hi, si and st (for CPU usage)?

When I issue top in Linux, I get a result similar to this: One of the lines has CPU usage information represented like this: Cpu(s): 87.3%us, 1.2%sy, 0.0%ni, 27.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st While I know the definitions of each of…
its_me
  • 13,709
  • 23
  • 54
  • 52
110
votes
2 answers

Understanding %CPU while running top command

I am trying to understand what %CPU means when I run top. I am seeing %CPU for my application at "400" or "500" most of the time. Does anyone know what this means? 19080 david 20 0 27.9g 24g 12m S 400 19.7 382:31.81 paper_client lscpu gives…
david
  • 2,147
  • 7
  • 25
  • 31
94
votes
2 answers

How to limit a process to one CPU core in Linux?

How to limit process to one cpu core ? Something similar to ulimit or cpulimit would be nice. (Just to ensure: I do NOT want to limit percentage usage or time of execution. I want to force app (with all it's children, processes (threads)) to use one…
Grzegorz Wierzowiecki
  • 13,865
  • 23
  • 89
  • 137
85
votes
3 answers

What does an idle CPU process do?

Looking at the source of strace I found the use of the clone flag CLONE_IDLETASK which is described there as: #define CLONE_IDLETASK 0x00001000 /* kernel-only flag */ After looking deeper into it I found that, although that flag is not covered in…
grochmal
  • 8,489
  • 4
  • 30
  • 60
79
votes
15 answers

Checking if HyperThreading is enabled or not?

How can I check if hyperthreading is enabled on a Linux machine, using a perl script to check for it? I'm trying the following way: dmidecode -t processor | grep HTT Let me know if I'm on right track.
doubledecker
  • 1,807
  • 3
  • 15
  • 12
78
votes
5 answers

So what are logical cpu cores (as opposed to physical cpu cores)?

I was googling about how I could find the number of CPUs in a machine and I found some posts but I am confused as some mentioned that you get the logical cores vs physical cores etc. So what is the difference between logical and physical cores and…
Jim
  • 9,750
  • 15
  • 57
  • 84
78
votes
6 answers

What is the correct way to view your CPU speed on Linux?

I found two commands to output information about my CPU: cat /proc/cpuinfo and lscpu. /proc/cpuinfo shows that my CPU speed is 2.1 Ghz, whereas lspcu says it is 3167 Mhz. Which one is correct? This is my exact output from cat /proc/cpuinfo about my…
Rohan
  • 3,491
  • 9
  • 28
  • 45
78
votes
6 answers

How to determine the maximum number to pass to make -j option?

I want to compile as fast as possible. Go figure. And would like to automate the choice of the number following the -j option. How can I programmatically choose that value, e.g. in a shell script? Is the output of nproc equivalent to the number…
tarabyte
  • 4,166
  • 10
  • 36
  • 48
67
votes
2 answers

Top and ps not showing the same cpu result

This is linked to this question. When I run top I get the following result: pid 3038 is using 18% cpu, however when running the result is 5.5%. And this number does not appear to be changing with time (i.e. when running the same command a bit…
Theodor
  • 939
  • 1
  • 8
  • 9
57
votes
8 answers

how to find out intel architecture family from command line

I get access to some xeon machines for checking performance. I want to find out what architecture they are using such as Haswell, Sandybridge , Ivybridge. Is there a command to find this out?
a curious engineer
  • 621
  • 1
  • 6
  • 6
53
votes
3 answers

VirtualBox: Is it a bad idea to assign more virtual CPU cores than number of physical CPU cores

VirtualBox: As I have Hyper-Threading capable CPU, I wonder: Is it a bad idea to assign more virtual CPU cores than a number of physical CPU cores as the following warning suggests (simply using all 8 virtual cores of 4 physical core CPU for…
Vlastimil Burián
  • 27,586
  • 56
  • 179
  • 309
48
votes
4 answers

How can I set the processor affinity of a process on Linux?

How can I set the processor affinity of a process on Linux?
chillitom
  • 633
  • 1
  • 8
  • 8
47
votes
1 answer

What are software and hardware interrupts, and how are they processed?

I am not sure if I understand the concept of hardware and software interrupts. If I understand correctly, the purpose of a hardware interrupt is to get some attention of the CPU, part of implementing CPU multitasking. Then what issues a hardware…
Tim
  • 98,580
  • 191
  • 570
  • 977
1
2 3
54 55