Deutsch   English   Français   Italiano  
<101fbpo$19jus$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Muttley@dastardlyhq.com
Newsgroups: comp.unix.programmer
Subject: Setting child proc affinity before fork() ?
Date: Sat, 31 May 2025 16:46:48 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <101fbpo$19jus$1@dont-email.me>
Injection-Date: Sat, 31 May 2025 18:46:48 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="af960e5e7fae37453eaa061a9ea18c34";
	logging-data="1363932"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19BmwGe+KIVWvxYFFXF6MUs"
Cancel-Lock: sha1:Xh8EP3XDnSHoy7uO6L3TSGU1/OI=
Bytes: 1293

The CPU_* macros and sched_setaffinity() etc allow you to try and force a
given process to run on a given CPU/core , but is there a way to set the
affinity of a process yet to be created by fork() ? Eg if I have a parent
process running on CPU 0 can I make it so that the child will run on CPU 1
before the child is created so that the child itself doesn't have to set
the affinity? I'm thinking of situations with fork-exec when the exec'd
binary won't set any affinity so the parent needs to do it for it.

Thanks for any help.