Hot answers tagged

140

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 ...


61

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 ...


43

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> ...


41

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 # ...


41

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 ...


27

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 ...


23

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.


21

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 ...


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

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 ...


15

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) ...


15

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 ...


15

%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 ...


14

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, ...


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.


12

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) ))


12

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 ...


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

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


11

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 ...


10

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 ...


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

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


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

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

Use cron because it is a better and more standard practice. At least if this is something that will regularly run (not just something you patched together in a minute). cron is a cleaner and more standard way. It's also better because it runs the shell detached from a terminal - no problem with accidental termination and dependencies on other processes. ...


9

It is not something new. It dates way back to 1970's when it got introduced. Quoting from here, One of the earliest accounts of a fork bomb was at the University of Washington on a Burroughs 5500 in 1969. It is described as a "hack" named RABBITS that would make two copies of itself when it was run, and these two would generate two more copies ...


9

You have to look at sockets and cores per socket. In this case you have 1 physical CPU (socket) which has 4 cores (cores per socket).



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