home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / ada / 2445 < prev    next >
Encoding:
Internet Message Format  |  1992-08-26  |  3.5 KB

  1. From: offer@spock.camb.inmet.com
  2. Date: 26 Aug 1992 10:16 EDT
  3. Newsgroups: comp.lang.ada
  4. Subject: Re: Dynamic Task Creation/Control
  5. Message-ID: <20600139@spock>
  6. Path: sparky!uunet!inmet!inmet!spock!offer
  7. Nf-ID: #R:<1992Aug20:174857:spock:20600139:000:3179
  8. Nf-From: spock.camb.inmet.com!offer    Aug 26 10:16:00 1992
  9. References: <174857@<1992Aug20>
  10. Lines: 72
  11.  
  12.  
  13. >     The area where wisdom is needed deals with the dynamic creation of tasks. 
  14. > Since Ada tasking essential keeps the memory assigned to an access type
  15. > task until termination of the task that has the access type defined, I am 
  16. > forced to create a 'task-control-block' that keeps track of which tasks 
  17. > are currently being used.  In addition, I have to try and reuse these 
  18. > tasks for different 'procedural code'.  Any suggestions?
  19. >     Also, when 'it is decided' to terminate a task ( done normally because it
  20. > has passed it's deadline ), I need to reclaim the task-control-block and 
  21. > be able to reuse it.  
  22.  
  23. As for Ada 83, you are pretty much at the mercy of the sepcific vendor your 
  24. working with since most of the behavior you're requesting is implementation
  25. defined.
  26.  
  27. Unchecked_Deallocation on the tasks (afetr they terminate) might solve some
  28. of the problem, although it is not uniformly implemented for tasks.
  29.  
  30. Second, it seems from your note that the "limitation of the access task types"
  31. is artificial in your case.  If this is true, than you don't have to have the
  32. access to task types, so "high" in the scope.  If your tasks serve mainly as
  33. containers or as the execution threads for dynmaically chosen procedures, 
  34. then it seems that the task types (entries profile, bodies, etc) themselves 
  35. don't vary much.  Therefore, the same access to task type X1 does not have
  36. to be shared by the entire program, and instead it can be declared in a deeper
  37. scope.  Doing so will more likely cause the implementation to release task
  38. space when the (deeper) scope is exited.  You may also still use the same
  39. task type, but with multiple access-to-task-types declared in various places,
  40. but in order to be more specific, one has to know more about the inter-
  41. dependencies of the tasks, their interaction, data visibility, etc.
  42.  
  43. You've talked about a TCB; I assume that this is YOUR TCB, not the RTS
  44. one.  I also assume that it is there just to keep track of re-usable tasks
  45. and if the problem of reclaiming the storage was gone, you did not need this
  46. construct.  If this is so, then the problem of deallocating the TCB's is gone
  47. too.
  48.  
  49.  
  50. In the proposed Ada 9X, you life may be a bit easier; there are several 
  51. features that can help here.
  52.  
  53. 1. User-defined allocators, will allow you to intervene in allocation/
  54.    deallocation and to do the right thing.
  55.  
  56. 2. You'll be able to allocate storage pools for certain purpose with 
  57.    specific life time.
  58.  
  59. 3. With ROOT_TASK_CLASS and the TASK_IDENTIFICATION package, you'll be able 
  60.    to more eaasily manipulate task objects on your own.
  61.  
  62. 4. Finalization will also help you get rid of objects in a more controlled
  63.    way.
  64.  
  65. Most of these features are not in the planned core, but rather in the
  66. System Programming and Real-Time annexes.
  67.  
  68. The above list is not intended to be complete or self-explanatory.  Check
  69. the appropriate 9X documents, if you are interested.
  70.  
  71. > However, I am at a loss to come up with a good way to 
  72. > insure it is in a known state.  Again, any suggestions?
  73.                     ^^^^^^^^^^^
  74.  
  75. I am not sure I understand this problem, assuming that my interpretation
  76. of the TCB is correct.
  77.  
  78.  
  79.  
  80. Offer Pazy
  81.  
  82. MRT
  83.  
  84.