Jonathan Joyce
Jonathan Joyce

Reputation: 13

Linux - Need to limit a 16 core system to 4 to test performance running multiple programs

I have a couple of programs that will be put on a system with limited core's. I want to test performance of these programs on my current system that is a lot more powerful than the one it will be on.

Is the only way to fully limit the proper resource is through a Virtual Machine on my system, or can I just restrict my system to meet the same core limit as the other system my programs will run on?

Upvotes: 1

Views: 48

Answers (1)

daniel.heydebreck
daniel.heydebreck

Reputation: 445

taskset might help you.

Start your application your_command as follows:

taskset -ac 0-3 your_command
# -c 0-3: your_command might run on cores 0 to 3
#  a    : all of the 4 cores may be used

If the application is already running:

taskset -acp 0-3 PID
# PID = process ID

See this answer to 'Limit process to one cpu core' at Unix & Linux for further details .

Upvotes: 2

Related Questions