On Tue, Feb 11, 2014 at 9:03 AM, Chris Davies <ch...@roaima.co.uk> wrote:
> Marco Ippolito <maroloc...@gmail.com> wrote:
>> How can I `echo', in `bash', the core # the current script is running on?
>
> This will probably do it for you
>     awk '{print $39}' /proc/$$/stat
>
> See proc(5) for details, including the 39. Please also note that unless
> you've set the task affinity (see taskset(1) for details) the process
> can - and will - be reassigned different cores during its lifetime.

Heh. What odds do you give it that the processor will be running on a
different core by the time his script has IDed the core? Or maybe even
cycled back again?

But, I guess if the OP's purpose is just to prove that scripts are not
confined to a single core, I guess it doesn't matter. (I can't say
that I can think of any other reason for the question, now that I
think of it. Hmm)

-- 
Joel Rees

Be careful where you see conspiracy.
Look first in your own heart.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAAr43iPfjz+ArCSTmcT+Z15LA=z8jhjxyfopb9gb4k4abel...@mail.gmail.com

Reply via email to