How to set affinity of a process

12 views
Skip to first unread message

Zakirasafi

unread,
Jun 17, 2016, 6:13:06 AM6/17/16
to ossec-list

Dear all


I want to permanently assign different cores to 2 different processes. I mean when I will execute process one it always must execute on core 1 and the 2nd process always execute on core2. How i will do this by set affinity.


Thanks and Regards,
Zakira Inayat
Ph.D Scholar in University of Malaya, Malaysia

dan (ddp)

unread,
Jun 17, 2016, 6:45:46 AM6/17/16
to ossec...@googlegroups.com
On Fri, Jun 17, 2016 at 6:13 AM, Zakirasafi <zakir...@gmail.com> wrote:
>
> Dear all
>
>
> I want to permanently assign different cores to 2 different processes. I
> mean when I will execute process one it always must execute on core 1 and
> the 2nd process always execute on core2. How i will do this by set affinity.
>

Based on a 30 second google search, and a quick ssh session to a linux machine:
taskset

>
> Thanks and Regards,
> Zakira Inayat
> Ph.D Scholar in University of Malaya, Malaysia
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ossec-list" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ossec-list+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Zakirasafi

unread,
Jun 19, 2016, 11:20:16 PM6/19/16
to ossec-list
Yeah, I already used the taskset command but through taskset command when I execute the program for the 2nd time the core has been changed. Everytime the code is changing when the program is execute. I want to permanently assign a specific core to a specific process. 





Thanks and Regards,
Zakira Inayat
Ph.D Scholar in University of Malaya, Malaysia

dan (ddp)

unread,
Jun 19, 2016, 11:26:05 PM6/19/16
to ossec...@googlegroups.com


On Jun 19, 2016 11:20 PM, "Zakirasafi" <zakir...@gmail.com> wrote:
>
> Yeah, I already used the taskset command but through taskset command when I execute the program for the 2nd time the core has been changed. Everytime the code is changing when the program is execute. I want to permanently assign a specific core to a specific process. 
>
>

Add the taskset command to the ossec-control sxript.

Zakirasafi

unread,
Jun 20, 2016, 2:49:29 AM6/20/16
to ossec-list
$ ps -eo psr , pid // pid is process id

i want to assign core 1 to process 1350
 I have written the following command
$taskset -c 1 -p 1350 (I want that core is permanently assigned to process 1350)

But this core 1 is not permanently assigined to process 1350.




Thanks and Regards,
Zakira Inayat
Ph.D Scholar in University of Malaya, Malaysia

dan (ddp)

unread,
Jun 20, 2016, 8:13:33 AM6/20/16
to ossec...@googlegroups.com
On Mon, Jun 20, 2016 at 2:49 AM, Zakirasafi <zakir...@gmail.com> wrote:
> $ ps -eo psr , pid // pid is process id
>
> i want to assign core 1 to process 1350
> I have written the following command
> $taskset -c 1 -p 1350 (I want that core is permanently assigned to process
> 1350)
>
> But this core 1 is not permanently assigined to process 1350.
>
>

If the process is using different cores after setting it to use a
specific core, you would probably have to talk to your distribution to
find out what is going on.
This doesn't sound like an OSSEC problem.
Reply all
Reply to author
Forward
0 new messages