what is simplest way to warm up CPU above 90 % usage [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
Sorry if this question seems to be foolish. I want to know how can i put my CPU to work that it's usage increase in arbitrary time. for example i want to turn it over 90 % usage.
if Linux command exists or a simple program to do that it will be a pleasure.

Start running BOINC and use your spare capacity to process data for science. You can control how much of your CPU (and GPU) you assign to background processing and you never know - you may be the one to provide the trigger for a cure for cancer or muscular dystrophy.
Keeps you machine occupied doing something useful while you're taking your time punching keys...

Try the following program, compiled in C++
int main() {
for (;;)
;
}
It will sit in a tight loop and chew up available clock cycles.

Related

What consumes memory in linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 5 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I use atop cmd to check memory usage.
on the screenshot use can I see I have 1gb total, and 300mb free.
how do I found out what consumes other ~700mb?
I tried to use atop cmd, but that doesn't give me much information.
a memory leak occurs when a process doesn't give memory back that it doesn't need anymore
so first run top and type > key to sort by memory utilization or virtual memory utilization
you should review how much swap you are using in /proc/meminfo then check the inactive(anon) if it has high value that is bigger than the swap memory then make your swap is greater than it
finally, run free -m to see the memory details
if you find cache is high run the following command
echo 3 > /proc/sys/vm/drop_caches; sync
then run free -m again to see the changes
I think glances utility is better suited for this purpose. It is more user friendly and provides various options for real time server stats. For more information about the utility, see this page.

What does it mean to break user space? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
This may be a simple question but, I heard that the only rule in working on the kernel is that you don't break "user space". So I was wondering what that means: To break user space and how does it happen?
Edit
It has been pointed out to me that this question is not suited for Stack Over Flow by #lurker so I will move it to Super User as #lurker suggests. (See below)
"Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – lurker, jww, SilentKiller
You're referring to Linus Torvald's first rule of kernel development. This note explains it: https://lkml.org/lkml/2012/12/23/75. I.e., when maintaining the kernel, do not do something which breaks user programs/applications. In other words, when making kernel changes, it is very bad to cause problems in the user's application "space". That doesn't literally mean memory. That means anything that impacts the user applications in a way that negatively affects its behavior (causes the program to malfunction). The note I cite also indicates at least one example.

What are the odds of a PID getting assigned to the same process after a wraparound? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I understand that /proc/* contains directories that are actually PIDs.
I have a custom process that is killed and spawned every few minutes.
What are the chances of a PID (for example, 1009) getting reused by the custom process? (After wrapping around pid_max)
Is it likely enough to happen that my code should deal with it?
High enough that you should expect it to happen and be prepared to deal with it. The actual probability will of course depend on how often other processes are being created on your system. There is certainly no guarantee that it won't happen, though, so you must assume that it will.
"What are the odds" is a statistics question, and the answer depends on how many other processes there are, and how often they fork() and how often they exit(), so the exact answer is difficult to calculate. Anywhere between "almost impossible to happen" and "nearly guaranteed to happen every minute."
If the question is "could this happen in my lifetime and should I handle that in my code" then the answer is yes.

How to choose a processor in Linux? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I am using a Linux computer (Ubuntu) with n processors (15 as listed by /proc/cpuinfo). I have to run several applications and would like to run one in each processor. Is there a way to assign a processor to each application, or is it something that Linux does automatically?
Thank you very much
What you are looking for is called affinity.
Linux should already handle this on its own, but there are ways of changing the affinity of a process (sched_setaffinity) and also the command line tool taskset(1).
taskset is used to set or retrieve the CPU affinity of a
running process given its PID or to launch a new COMMAND with a
given CPU affinity.
Using taskset you can launch a process that will only become eligible to run on the cores you specify.
I'm not entirely sure they're the best tool for the job, but you might also want to investigate cgroups. I am almost certain they also allow pinning processes on certain CPUs.

SSH How to scrutinise what a PID is doing? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have a rogue Apache process running on a Centos 6 Linux server, which is running up to 55% CPU and wondered how I can scrutinise exactly what function(s) it is performing? From the 'top' command I have its process ID, but how can I drill in to what it's up to?
Thank you
If you really want to see what it's doing, get familiar with the strace command. It will show you the system calls your process is making, but I imagine it would be a terrible tool for finding out performance issues. For that, take a look at something like gprof.

Resources