How to choose a processor in Linux? [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 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.

Related

How to see who kills execution of the script? [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 4 years ago.
Improve this question
There's a complicated script that starts other scripts. It all runs for about 6 hours. But I've noticed that one or two child scripts are being killed from time to time.
All I get is a line in log saying that script is killed.
How do I get some info on who kills it? Is it possible?
The nature of killing a process does not provide an originator. A bit is set in a kernel structure associated with the process, indicating a signal is pending. If the signalling process does not indicate it is signalling, there's no way to find out.
Some processes do in fact announce their signalling. On Linux, the OOM (Out of Memory) killer might write a log entry to /var/log/messages. If the reason for the signalling to your script is an OOM condition, this might be the place to look.
See also Who "Killed" my process and why?

fork() bomb explanation in terms of processes? [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
I am just wondering how a fork bomb works, I know that there are similar questions but the answers aren't quite what I am looking for (or maybe I just haven't been able to come across one)
How does it work in terms of processes?
Do children keep being produced and then replicating themselves? is the only way to get out of it is by rebooting the system?
Are there any long lasting consequences on the system because of a fork bomb?
Thanks!
How does it work in terms of processes?
It creates so many processes that the system is not able to create any more.
Do children keep being produced and then replicating themselves?
Yes, fork in the name means replication.
is the only way to get out of it is by rebooting the system?
No, it can be stopped by some automated security measures, eg. limiting the number of processes per user.
Are there any long lasting consequences on the system because of a fork bomb?
A fork bomb itself does not change any data but can temporarily (while it runs) cause timeouts, unreachable services or OOM. A well-designed system should handle that but, well, reality may differ.

Start a process on a specific core/CPU? [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
Is there a way to specify that an application run on a specific core on linux? Like for example:
firefox core0
Or something that'd function that way conceptually?
Make use of taskset from util-linux
cpuset also seems to be working. I'm not too familiar with it though. cpuset
Using taskset, which is a part of util-linux package you can do this. For details check here
Using taskset you can assign a running process to particular CPU core. For example, to assign a process to CPU core 0 and 4, do the following.
taskset -p 0x11 <pid>

what is simplest way to warm up CPU above 90 % usage [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
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.

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