Tagadac
Tagadac

Reputation: 423

Using one cpu core per task

I have a dual core board running Linux in which I installed PJSIP (VoIP software). I want to add an echo/noise canceler algorithm but I don't want it to work on the same core as PJSIP.

How can I split the use of the cores between the two applications?

Upvotes: 2

Views: 92

Answers (2)

Sam
Sam

Reputation: 299

The term you are looking for is affinity. http://man7.org/linux/man-pages/man2/sched_setaffinity.2.html or http://www.glennklockwood.com/hpc-howtos/process-affinity.html. That being said, if you are using a "slow" cpu, you are probably going to look at a real time scheduler (SCHED_FIFO, SCHED_RR or SCHED_DEADLINE) and if you are using a "fast" cpu you probably don't need to worry about affinity. The probability of you being in the "middle" where affinity will matter but scheduler won't is pretty low.

Upvotes: 1

Andriy Berestovskyy
Andriy Berestovskyy

Reputation: 8544

It is called CPU affinity. You can set it from the command line using taskset(1) or from your application using sched_setaffinity(2) sched_getaffinity(2).

Upvotes: 1

Related Questions