From: Michael Erdmann <michael.erdmann@snafu.de>
Subject: Q: Binding tasks to CPU's seems not to work with Task_Info pragma?!
Date: 10 Aug 2013 17:56:44 GMT
Date: 2013-08-10T19:56:44+02:00 [thread overview]
Message-ID: <52067edc$0$82030$afc38c87@news5.united-newsserver.de> (raw)
Hallo,
i am trying to bind my task to specific processors using gnat packages.
function CPU( i : Positive ) return Task_Info.Task_Info_Type is
T : Task_Info.Task_Info_Type := new Thread_Attributes;
begin
T.CPU_Affinity.bits := (others => false );
T.CPU_Affinity.bits(i) :=true;
return T;
end;
task type Task_Type( id : Natural ) is
Pragma Priority(4);
Pragma Task_Info(CPU(Id));
end Task_Type;
TT : array(1..Nbr_Of_Threads) of Task_Access;
begin
for i in TT'Range loop
TT(i) := new Task_Type(i);
end loop;
....
Assume Nbr_Of_Threads = 4; i get on my linux box (OpenSuse 12.3) the following
top results.
top - 19:40:02 up 31 min, 2 users, load average: 1.77, 0.46, 0.19
Tasks: 200 total, 1 running, 199 sleeping, 0 stopped, 0 zombie
Cpu0 : 0.3%us, 0.0%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu1 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu2 :100.0%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu3 :100.0%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu4 :100.0%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu5 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu6 :100.0%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu7 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 3981796k total, 669496k used, 3312300k free, 856k buffers
Swap: 10482408k total, 0k used, 10482408k free, 340328k cached
I would have expected CPU 0..3 being busy. Even worse the next time i start
my program the cpu's are assigned differently :-/
I am a bit frustrated because i can do the trick with taskset without any
major effort. Any idea what i am doing wrong?
The complete source should be avaiable here: https://gist.github.com/merdmann/6201405
I am using:
gcc version 4.5.4 20120510 for GNAT GPL 2012 (20120509) (GCC)
Linux hal 3.1.10-1.29-xen #1 SMP Fri May 31 20:10:04 UTC 2013 (2529847) x86_64 x86_64 x86_64 GNU/Linux
Thanx in advance
Michael
next reply other threads:[~2013-08-10 17:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-10 17:56 Michael Erdmann [this message]
2013-08-10 19:17 ` Q: Binding tasks to CPU's seems not to work with Task_Info pragma?! AdaMagica
2013-08-10 19:51 ` Michael Erdmann
2013-08-12 20:34 ` Randy Brukardt
2013-08-12 21:49 ` Simon Wright
2013-08-13 4:29 ` Michael Erdmann
2013-08-13 5:15 ` Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox