I think you are mixing two concepts that have different meaning than you have described. They have different usage workflows. It all comes to what you actually need
Real-Time
The real-time, in linux I presume, is designed to provide predictable and deterministic behaviour for any time-sensitive application(s).
In the ordinary linux processes are using scheduler which has different priorities and time-sharing. Those can be influenced, by e.g. nice. The real-time Linux ensures that the time critical tasks gets immediate attention and executes within certain time constrains.
CPU Affinity
Processor affinity actually binds a process to a specific processor(s). That is the reason why it is also called CPU pinning.
Imagine having a machine with 128 processors. Why would you like to pin a process to certain processor? The main reason for cpu affinity is to avoid cache misses, which causes latency issues. With 128 processors that could be a real issue which could slow down the task you would be doing.
Answer
So, with the help of process affinity a program that was written for an Arduino can be ported to a Linux board like Raspberry Pi Zero 2 W (which has a quad-core CPU) and would have all the benefits of a micro-controller only with a faster CPU.
To answer your question processor affinity is for optimizing cache performance, which improves latency, but it does not guarantee any deterministic behaviour to time-critical applications. On the other hand, real-time kernel should guarantee a deterministic bahaviour.
Depends on what kind of application we are talking. If you need to for it to behave in a deterministic way, meaning you will get always answer within a certain time-frame then use real-time linux implementation.
If you need to avoid cache misses you can try CPU affinity.