comp.lang.ada
 help / color / mirror / Atom feed
* Tasking_Error
@ 2003-03-16 16:53 Stefan Soos
  2003-03-16 17:22 ` Tasking_Error James S. Rogers
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Stefan Soos @ 2003-03-16 16:53 UTC (permalink / raw)


Hallo all,

when i run the following program on Linux 2.4.18 with Gnat 3.14p-3 I
always get the following exception information:
Exception name: TASKING_ERROR
Message: Failure during activation

Here's the program:
--  Cut here  --
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Exceptions; use Ada.Exceptions;
procedure Task_Stressing is

   Maximum_Tasks : constant := 5000;

   task type Called_Task_Type is
      entry Start;
      entry Rendevouz;
   end Called_Task_Type;

   task body Called_Task_Type is
   begin
      accept Start;
      Put ("Tasks waiting so far: ");
      Put (Rendevouz'Count);
      New_Line;
      accept Rendevouz;
   end Called_Task_Type;

   Called_Task : Called_Task_Type;

   task type Calling_Task_Type is
      entry Start;
   end Calling_Task_Type;

   task body Calling_Task_Type is
   begin
      accept Start;
      Called_Task.Rendevouz;
   end Calling_Task_Type;

   type Calling_Task_Access is access Calling_Task_Type;

   type Calling_Task_List;
   type Calling_Task_List_Access is access all Calling_Task_List;
   type Calling_Task_List is
      record
         Next : Calling_Task_List_Access := null;
         Item : Calling_Task_Access := null;
      end record;
   Head : Calling_Task_List_Access;
   List_Items : Calling_Task_List_Access;
   Tasks_Created : Natural := 0;
begin
   Head := new Calling_Task_List;
   Head.Item := new Calling_Task_Type;
   List_Items := Head;
   Tasks_Created := Tasks_Created + 1;
   Create_Calling_Tasks :
   begin
      for I in 2 .. Maximum_Tasks  loop
         List_Items.Next := new Calling_Task_List;
         if (I mod 100) = 0 then
            Put (".");
         end if;
         List_Items.Next.Item := new Calling_Task_Type;
         List_Items := List_Items.Next;
         Tasks_Created := Tasks_Created + 1;
      end loop;
   exception
      when E : others =>
         New_Line;
         Put ("Tasks created: ");
         Put (Tasks_Created);
         New_Line;
         Put_Line (Exception_Information (E));
   end Create_Calling_Tasks;
   List_Items := Head;
   New_Line (2);
   STart_Calling_Tasks :
   for I in 1 .. Maximum_Tasks loop
      if List_Items.Item /= null then
         List_Items.Item.Start;
         if (I mod 100) = 0 then
            Put ("!");
         end if;
         List_Items := List_Items.Next;
      else
         exit Start_Calling_Tasks;
      end if;
   end loop Start_Calling_Tasks;
   New_Line (1);
   Called_Task.Start;
end Task_Stressing;
--  Cut here  --


Am I missing something or why is the program behaving faulty?
I don't know if it is of interest but my limit settings are:

core file size        (blocks, -c) 0
data seg size         (kbytes, -d) unlimited
file size             (blocks, -f) unlimited
max locked memory     (kbytes, -l) unlimited
max memory size       (kbytes, -m) unlimited
open files                    (-n) 1024
pipe size          (512 bytes, -p) 8
stack size            (kbytes, -s) unlimited
cpu time             (seconds, -t) unlimited
max user processes            (-u) 4095
virtual memory        (kbytes, -v) unlimited

Thanks for any ideas,
Stefan

-- 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tasking_Error
  2003-03-16 16:53 Tasking_Error Stefan Soos
@ 2003-03-16 17:22 ` James S. Rogers
  2003-03-16 17:48   ` Tasking_Error Stefan Soos
  2003-03-17  7:30   ` Tasking_Error Pascal Obry
  2003-03-17  8:03 ` Tasking_Error Egil Harald H�vik
  2003-03-17 10:10 ` Tasking_Error Lutz Donnerhacke
  2 siblings, 2 replies; 8+ messages in thread
From: James S. Rogers @ 2003-03-16 17:22 UTC (permalink / raw)


"Stefan Soos" <stefan.soos@gmx.de> wrote in message
news:r6a25b.1bt.ln@ID-soos.user.dfncis.de...
> Hallo all,
>
> when i run the following program on Linux 2.4.18 with Gnat 3.14p-3 I
> always get the following exception information:
> Exception name: TASKING_ERROR
> Message: Failure during activation
>
> Here's the program:
> --  Cut here  --
> with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
> with Ada.Text_IO; use Ada.Text_IO;
> with Ada.Exceptions; use Ada.Exceptions;
> procedure Task_Stressing is
>
>    Maximum_Tasks : constant := 5000;
>
>    task type Called_Task_Type is
>       entry Start;
>       entry Rendevouz;
>    end Called_Task_Type;
>
>    task body Called_Task_Type is
>    begin
>       accept Start;
>       Put ("Tasks waiting so far: ");
>       Put (Rendevouz'Count);
>       New_Line;
>       accept Rendevouz;
>    end Called_Task_Type;
>
>    Called_Task : Called_Task_Type;
>
>    task type Calling_Task_Type is
>       entry Start;
>    end Calling_Task_Type;
>
>    task body Calling_Task_Type is
>    begin
>       accept Start;
>       Called_Task.Rendevouz;
>    end Calling_Task_Type;
>
>    type Calling_Task_Access is access Calling_Task_Type;
>
>    type Calling_Task_List;
>    type Calling_Task_List_Access is access all Calling_Task_List;
>    type Calling_Task_List is
>       record
>          Next : Calling_Task_List_Access := null;
>          Item : Calling_Task_Access := null;
>       end record;
>    Head : Calling_Task_List_Access;
>    List_Items : Calling_Task_List_Access;
>    Tasks_Created : Natural := 0;
> begin
>    Head := new Calling_Task_List;
>    Head.Item := new Calling_Task_Type;
>    List_Items := Head;
>    Tasks_Created := Tasks_Created + 1;
>    Create_Calling_Tasks :
>    begin
>       for I in 2 .. Maximum_Tasks  loop
>          List_Items.Next := new Calling_Task_List;
>          if (I mod 100) = 0 then
>             Put (".");
>          end if;
>          List_Items.Next.Item := new Calling_Task_Type;
>          List_Items := List_Items.Next;
>          Tasks_Created := Tasks_Created + 1;
>       end loop;
>    exception
>       when E : others =>
>          New_Line;
>          Put ("Tasks created: ");
>          Put (Tasks_Created);
>          New_Line;
>          Put_Line (Exception_Information (E));
>    end Create_Calling_Tasks;
>    List_Items := Head;
>    New_Line (2);
>    STart_Calling_Tasks :
>    for I in 1 .. Maximum_Tasks loop
>       if List_Items.Item /= null then
>          List_Items.Item.Start;
>          if (I mod 100) = 0 then
>             Put ("!");
>          end if;
>          List_Items := List_Items.Next;
>       else
>          exit Start_Calling_Tasks;
>       end if;
>    end loop Start_Calling_Tasks;
>    New_Line (1);
>    Called_Task.Start;
> end Task_Stressing;
> --  Cut here  --
>
>
> Am I missing something or why is the program behaving faulty?
> I don't know if it is of interest but my limit settings are:
>
> core file size        (blocks, -c) 0
> data seg size         (kbytes, -d) unlimited
> file size             (blocks, -f) unlimited
> max locked memory     (kbytes, -l) unlimited
> max memory size       (kbytes, -m) unlimited
> open files                    (-n) 1024
> pipe size          (512 bytes, -p) 8
> stack size            (kbytes, -s) unlimited
> cpu time             (seconds, -t) unlimited
> max user processes            (-u) 4095
> virtual memory        (kbytes, -v) unlimited

I believe that Linux implements tasks as user processes.
You are trying to create 5000 tasks with a user process
limit of 4095. The last 905 tasks you attempt to create
will fail due to the process limit.

Jim Rogers





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tasking_Error
  2003-03-16 17:22 ` Tasking_Error James S. Rogers
@ 2003-03-16 17:48   ` Stefan Soos
  2003-03-17  7:30   ` Tasking_Error Pascal Obry
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Soos @ 2003-03-16 17:48 UTC (permalink / raw)


Hi,


On Sun, 16 Mar 2003 17:22:15 GMT, James S. Rogers <jimmaureenrogers@worldnet.att.net> wrote:
> I believe that Linux implements tasks as user processes.
> You are trying to create 5000 tasks with a user process
> limit of 4095. The last 905 tasks you attempt to create
> will fail due to the process limit.
> 
> Jim Rogers
> 
> 

Well, I just reduced "Maximum_Tasks", but it doesn't work either.
"Tasks_Created" is indicating that there were 1019 tasks created before
the exception occurs.

Bye,
Stefan

-- 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tasking_Error
  2003-03-16 17:22 ` Tasking_Error James S. Rogers
  2003-03-16 17:48   ` Tasking_Error Stefan Soos
@ 2003-03-17  7:30   ` Pascal Obry
  2003-03-17 21:43     ` Tasking_Error Anders Gidenstam
  1 sibling, 1 reply; 8+ messages in thread
From: Pascal Obry @ 2003-03-17  7:30 UTC (permalink / raw)



"James S. Rogers" <jimmaureenrogers@worldnet.att.net> writes:

> I believe that Linux implements tasks as user processes.

No it uses threads.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tasking_Error
  2003-03-16 16:53 Tasking_Error Stefan Soos
  2003-03-16 17:22 ` Tasking_Error James S. Rogers
@ 2003-03-17  8:03 ` Egil Harald H�vik
  2003-03-17 10:10 ` Tasking_Error Lutz Donnerhacke
  2 siblings, 0 replies; 8+ messages in thread
From: Egil Harald H�vik @ 2003-03-17  8:03 UTC (permalink / raw)



Well, you have 5000 tasks calling the Called_Task.Rendevouz entry
on the same instance of Called_Task_Type, but
you accept the Rendevouz entry only once.

I believe that the RM is very specific about this case:
RM 9.5.3(21)



~egilhh






^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tasking_Error
  2003-03-16 16:53 Tasking_Error Stefan Soos
  2003-03-16 17:22 ` Tasking_Error James S. Rogers
  2003-03-17  8:03 ` Tasking_Error Egil Harald H�vik
@ 2003-03-17 10:10 ` Lutz Donnerhacke
  2003-03-17 11:15   ` Tasking_Error Adrian Knoth
  2 siblings, 1 reply; 8+ messages in thread
From: Lutz Donnerhacke @ 2003-03-17 10:10 UTC (permalink / raw)


* Stefan Soos wrote:
> when i run the following program on Linux 2.4.18 with Gnat 3.14p-3 I
> always get the following exception information:
> Exception name: TASKING_ERROR
> Message: Failure during activation

This is caused by the OS, you have. The number of processes is limited and
even if you might using threads, you'll reach the limit.

OTOH the other advice about collecting all rendevouz calls is right, too.

The following excerpt works for me (ulimit 256 tasks, so maximum ist 229).

---CUT HERE---
   Maximum_Tasks : constant := 50;

   task type Called_Task_Type is
      entry Start;
      entry Rendevouz;
   end Called_Task_Type;

   task body Called_Task_Type is
   begin
      accept Start;
      Put ("Tasks waiting so far: ");
      Put (Rendevouz'Count);
      New_Line;
      loop
	 select
	    accept Rendevouz;
	 or terminate;
	 end select;
      end loop;
   end Called_Task_Type;
---CUT HERE---



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tasking_Error
  2003-03-17 10:10 ` Tasking_Error Lutz Donnerhacke
@ 2003-03-17 11:15   ` Adrian Knoth
  0 siblings, 0 replies; 8+ messages in thread
From: Adrian Knoth @ 2003-03-17 11:15 UTC (permalink / raw)


Lutz Donnerhacke <lutz@iks-jena.de> wrote:

> OTOH the other advice about collecting all rendevouz calls is right, too.
                                             ^^^^^^^^^

It's called rendezvous, like rendez-vous in French :)

-- 
mail: adi@thur.de  	http://adi.thur.de	PGP: v2-key via keyserver

Alle Kinder gehen zur Beerdigung, nur nicht Hagen, der wird getragen!



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tasking_Error
  2003-03-17  7:30   ` Tasking_Error Pascal Obry
@ 2003-03-17 21:43     ` Anders Gidenstam
  0 siblings, 0 replies; 8+ messages in thread
From: Anders Gidenstam @ 2003-03-17 21:43 UTC (permalink / raw)


In article <ullzee9hc.fsf@wanadoo.fr>,
	Pascal Obry <p.obry@wanadoo.fr> writes:
> 
> "James S. Rogers" <jimmaureenrogers@worldnet.att.net> writes:
> 
>> I believe that Linux implements tasks as user processes.
> 
> No it uses threads.

Yes, but threads on Linux are implemented as processes sharing the same
address space. (More or less, it depends somewhat on what you read
into the concept "process", but at least each thread has its own entry
in the process table.)

See the (Linux) manual page for clone(2) for more info.

/Anders
-- 
"Luck is my middle name," said Rincewind, indistinctly. "Mind you,
 my first name is Bad." 
   -- (Terry Pratchett, Interesting Times) 



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-03-17 21:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-16 16:53 Tasking_Error Stefan Soos
2003-03-16 17:22 ` Tasking_Error James S. Rogers
2003-03-16 17:48   ` Tasking_Error Stefan Soos
2003-03-17  7:30   ` Tasking_Error Pascal Obry
2003-03-17 21:43     ` Tasking_Error Anders Gidenstam
2003-03-17  8:03 ` Tasking_Error Egil Harald H�vik
2003-03-17 10:10 ` Tasking_Error Lutz Donnerhacke
2003-03-17 11:15   ` Tasking_Error Adrian Knoth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox