Hot answers tagged

125

x86 (32-bit a.k.a. i386–i686 and 64-bit a.k.a. amd64. In other words, your workstation, laptop or server.) FAQ: Do I have… 64-bit (x86_64/AMD64/Intel64)? lm Hardware virtualization (VMX/AMD-V)? vmx (Intel), svm (AMD) Accelerated AES (AES-NI)? aes TXT (TPM)? smx a hypervisor (announced as such)? hypervisor Most of the other features are only of interest ...


52

hi is the time spent processing hardware interrupts. Hardware interrupts are generated by hardware devices (network cards, keyboard controller, external timer, hardware senors, ...) when they need to signal something to the CPU (data has arrived for example). Since these can happen very frequently, and since they essentially block the current CPU while they ...


39

Under Linux, execute the sched_setaffinity system call. The affinity of a process is the set of processors on which it can run. There's a standard shell wrapper: taskset. For example, to pin a process to CPU #0 (you need to choose a specific CPU): taskset -c 0 mycommand --option # start a command with the given affinity taskset -c -p 0 1234 # ...


39

man ps in NOTES section. CPU usage is currently expressed as the percentage of time spent running during the entire lifetime of a process. This is not ideal, and it does not conform to the standards that ps otherwise conforms to. CPU usage is unlikely to add up to exactly 100%. And, guess you know, but you can also do: top -p <PID> ...


37

ARM On ARM processors, a few features are mentioned in the features: line. Only features directly related to the ARM architecture are mentioned there, not features specific to a silicon manufacturer or system-on-chip. The features are obtained from looking up the CPU id with read_cpuid() and looking it up in the processor type definitions known at compile ...


25

lscpu is telling you that your architecture is i686 (an Intel 32-bit CPU), and that your CPU supports both 32-bit and 64-bit operating modes. You won't be able to install x64 built applications since they're built specifically for x64 architectures. Your particular CPU can handle either the i386 or i686 built packages. There are a number of ways to verify ...


21

Look in /proc/cpuinfo. If you have the aes flag then your CPU has AES support. You can use this command: grep aes /proc/cpuinfo If you have some output, which will be like flags : a bunch of flags aes another bunch of flags , then you have AES.


20

There is cpulimit tool (also is present in debian repo and should be in other distros). It's usage is pretty simple: cpulimit -p PID -l MAX_CPU_LEVEL You can also use process name, or full path to binary. Details you can find on the man page.


18

I have used taskset for this. If you have taskset installed, something like: taskset -c 1,3 -p 45678 would set the process with id 45678 to have an affinity to cpus 1 and 3.


18

A hardware interrupt is not really part of CPU multitasking, but may drive it. Hardware interrupts are issued by hardware devices like disk, network cards, keyboards, clocks, etc. Each device or set of devices will have its own IRQ (Interrupt ReQuest) line. Based on the IRQ the CPU will dispatch the request to the appropriate hardware driver. (Hardware ...


17

Physical cores are just that, physical cores within the CPU. Logical cores are the abilities of a single core to do 2 or more things simultaneously. This grew out of the early Pentium 4 CPUs ability to do what was termed Hyper Threading (HTT). It was a bit of a game that was being played where sub components of the core weren't being used for certain types ...


14

I found this thread on lkml that answers your question a little. (It seems even Linus himself was puzzled as to how to find out the origin of those threads.) Basically, there are two ways of doing this: $ echo workqueue:workqueue_queue_work > /sys/kernel/debug/tracing/set_event $ cat /sys/kernel/debug/tracing/trace_pipe > out.txt (wait a few secs) ...


14

Use cron (or anacron). Cron is designed for running things at intervals. That is the only thing it does, and there has been a lot of work put into cron for many years to make it what it is today. The chances that you're going to write a better scheduler in your script are effectively nil. Using cron will work better, avoid having unnecessary code in your ...


13

To set niceness (CPU bound) use nice. To set IO niceness (IO bound) use ionice. Refer to the respective man pages for more information. You can use them together as follow: ionice -c 2 -n 0 nice -n -20 mplayer Note: the lowest level of niceness (lower means more favorable) you can define is determined by limits.conf. On my computer the file is located at ...


13

From Wikipedia: “In 2004, the initial 32-bit x86 instruction set of the Pentium 4 microprocessors was extended by the 64-bit x86-64 set.” Your /proc/cpuinfo output shows flags: … lm …. The flag lm stands for “long mode“ which means 64-Bit extension. Thus, you have indeed a 64-bit processor.


13

%CPU -- CPU Usage : The percentage of your CPU that is being used by the process. By default, top displays this as a percentage of a single CPU. On multi-core systems, you can have percentages that are greater than 100%. For example, if 3 cores are at 60% use, top will show a CPU use of 180%. See here for more information. You can toggle this ...


12

While it can be an abuse for memory, it isn't for CPU: when a CPU is idle, a running process (by "running", I mean that the process isn't waiting for I/O or something else) will take 100% CPU time by default. And there's no reason to enforce a limit. Now, you can set up priorities thanks to nice. If you want them to apply to all processes for a given user, ...


11

Well, since you're specifically asking how to know which IRQ is responsible for the number in mpstat, you can assume it's not the local interrupt timer (LOC), since those numbers are fairly equal, and yet mpstat shows some of those cpus at 0 %irq. That leaves IRQ 0, which is the system timer, and which you can't do anything about, and IRQ 177, which is tied ...


11

I use this script (from this thread on the Arch boards): #!/bin/bash read cpu a b c previdle rest < /proc/stat prevtotal=$((a+b+c+previdle)) sleep 0.5 read cpu a b c idle rest < /proc/stat total=$((a+b+c+idle)) CPU=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))


11

Use lscpu. It's in Debian package “util-linux”.


11

You're right, top appears to give incorrect CPU usage on first iteration. You can work around this issue like this: top -b -n2 | grep "Cpu(s)"|tail -n 1 | awk '{print $2 + $4}' This will of course take twice as much time, but it will work anyway. If you still want it work faster, you can use -d option, e.g. for 1-second total period of measurement use ...


10

Here is a script to print the total CPU usage for each user currently logged in, showPerUserCPU.sh: own=$(id -nu) for user in $(who | awk '{print $1}' | sort -u) do # print other user's CPU usage in parallel but skip own one because # spawning many processes will increase our CPU usage significantly if [ "$user" = "$own" ]; then continue; fi ...


9

I don't know that limiting CPU to the whole system is something that's possible without a lot of hacking, but you can easily limit the amount of CPU used by a single process using cpulimit The only way I can think of you being able to use this effectively is writing a wrapper script (can't really call it a script, it's so small) for the applications which ...


9

top in the summary reports usage relative to the CPU with all cores added up. On the other hand, when you look in the list of processes, top reports percent referenced to one core (real or HT). Try running a process with 4 threads that can eat up 4 CPU cores, you will find it using 400% CPU. I can't tell why, but that's how top works on all Linux system ...


9

1.0 is an average of one job waiting over the given time period, not 1 core at 100% utilisation. An idle computer has a load number of 0 and each process using or waiting for CPU (the ready queue or run queue) increments the load number by 1. Most UNIX systems count only processes in the running (on CPU) or runnable (waiting for CPU) states. However, Linux ...


9

The words “CPU”, “processor” and “core” are used in somewhat confusing ways. They refer to the processor architecture. A core is the smallest independent unit that implements a general-purpose processor; a processor is an assemblage of cores (on some ARM systems, a processor is an assemblage of clusters which themselves are assemblages of cores). A chip can ...


8

getconf WORD_BIT getconf LONG_BIT (the size of long integers) arch For example, on a Fedora 14 x64 system: % uname -a Linux grinchy 2.6.35.14-106.fc14.x86_64 #1 SMP Wed Nov 23 13:07:52 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux % getconf WORD_BIT 32 % getconf LONG_BIT 64 % arch x86_64


8

top will display what is using your CPU. If you have it installed, htop allows you more fine-grained control, including filtering by—in your case—CPU


8

From the T520's specs: Intel® Core™ i5-2520M processor (dual-core, 2.50GHz, 3MB Cache), The i5-2520M has 2 cores + hyper threading, for a total of 4 cores seen by the system.


8

Is this process interfering with other processes on your system? Why do you want to limit the CPU bzip2 uses? You can use the nice command to change a process's priority: $ nice -n 19 bzip2 <file> Additionally, you can try lowering the bzip2 compression level: $ bzip2 -1 <file>



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