Set Processor Affinity to group of cores

Hi
on multi-core system - I know I can set each process to run on specific core (Processor Affinity).
If I want to set process (which contains several threads) to run on group of core, how can I do it ?

For example:
If we have 8 core,
and two process each process contain 4 threads.
And I want the first process will run on cores 0,1,2,3 and the second process will run on cores 4,5,6,7.
How can I do it ?

We don't see your OS mentioned - this is OS specific.

Linux - Command line taskset [processor mask]
           Program         sched_setaffinity() which uses the cpu_set group of macros

Or you can use the GNU-specific pthread_setaffinity_np() to set CPU affinities on a per-thread basis.