1

TLDR: I am an idiot. It turns out that the library is for interfacing with OS spawned processes, not native Ada tasks.

I recently stumbled across this library for spawning tasks arbitrarily and I was wondering if the feature that it implements for System.OS_Lib is now a part of the default implementation of Ada 2012 from AdaCore/FSF.

I am unsure if Ada tasking in 2012 is concurrent or parallel, so I have tagged both in this post.

kuwze
  • 411
  • 4
  • 13
  • 1
    What you're asking is a bit unclear... perhaps you can explain more? Ada can (and always could) create tasks or even arrays of tasks at will - within the language, no library required - though distributing them across a processor network requires an Annex. My reading of the "spawn-manager" suggests that - if *these tasks* spawn other OS jobs (perhaps non-Ada, like grep etc) - there are serialization problems - e.g. which tasks do stdin etc connect to?) - and that Spawn Manager manages this OS interaction from multiple Ada tasks. So ... are you asking about Ada tasks, or OS spawn or both? –  Mar 06 '18 at 19:24
  • @BrianDrummond I am confused as to the purpose of the project, but I think you helped to clear that up. I thought `spawn-manager` was for creating tasks arbitrarily, as if the compiler/runtime would double-check and only allow for so many tasks to be created. But now it's obvious to me now that as you said it is for spawning OS processes such as `grep`. However, I still don't understand the point of the library, and I don't understand the serialization issues you refer to. – kuwze Mar 06 '18 at 19:31
  • 1
    I'm not too clear on it either, but it seems that Spawn Manager creates one more Ada task, and that task coordinates all I/O between your other Ada tasks and their spawned OS processes. I can imagine there could be chaos if you didn't do that and everything was routed through one stdin pipe... –  Mar 06 '18 at 19:51
  • 2
    My browsers won’t let me visit that site (invalid certificate), so I can’t comment. – Simon Wright Mar 06 '18 at 21:22
  • 1
    What you're talking about (OS_Lib) has nothing to do with spawning Ada tasks. It's about spawning additional OS processes. – Jeffrey R. Carter Mar 07 '18 at 09:30
  • 1
    It is still unclear what you want to know : something about Ada's tasking facilities? about System.OS_Lib to spawn OS jobs? or about combining them? –  Mar 07 '18 at 13:14

1 Answers1

2

Ada has at least since 1995 allowed spawning of tasks anywhere you like it in your application. There are two/three ways of doing it:

In a declarative region:

Some_Task  : Some_Task_Type;
Other_Task : Soma_Task_Access := new Some_Task_Type;

In a statement:

Other_Task := new Some_Task_Type;
Jacob Sparre Andersen
  • 6,733
  • 17
  • 22