home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / amiga / programm / 18391 < prev    next >
Encoding:
Internet Message Format  |  1993-01-08  |  10.3 KB

  1. Path: sparky!uunet!oracle!unrepliable!bounce
  2. Newsgroups: comp.sys.amiga.programmer
  3. From: dnavas@oracle.uucp (David Navas)
  4. Subject: Re: IPC and shared memory
  5. Message-ID: <1993Jan8.222418.21348@oracle.us.oracle.com>
  6. Sender: usenet@oracle.us.oracle.com (Oracle News Poster)
  7. Nntp-Posting-Host: mailseq.us.oracle.com
  8. Organization: Oracle Corporation, Redwood Shores CA
  9. References: <1ifq0hINNak2@uwm.edu> <1993Jan7.203535.11473@oracle.us.oracle.com> <1iihaaINN7fv@swrinde.nde.swri.edu>
  10. Date: Fri, 8 Jan 1993 22:24:18 GMT
  11. X-Disclaimer: This message was written by an unauthenticated user
  12.               at Oracle Corporation.  The opinions expressed are those
  13.               of the user and not necessarily those of Oracle.
  14. Lines: 179
  15.  
  16. In article <1iihaaINN7fv@swrinde.nde.swri.edu> kent@stanley.nde.swri.edu (Kent D. Polk) writes:
  17. >In our case, a module master process which (as Dave described earlier)
  18. >manages pretty much everything that the modules have in common.  Such
  19. >activities are transparent to the modules unless the module needs to do
  20. >something special with an attribute.  I.e. each module's simply defines a few
  21. >attribute and method structures and then calls the DoShadow function.  Signal
  22. >processing 'events' are managed via assigned processes. These processes run
  23. >the designated module instances' functions in its own process space while the
  24. >UI stuff, etc. is run in the module process space (I think :^)
  25.  
  26. Well....  Not quite ;)
  27.  
  28. Many of the module's methods actually do run in the traveller's process (for
  29. those of you not savvy with WEB DA&A, the traveller is responsible for
  30. traversing the data path as built by the user.  Typically, travellers
  31. are sent to a 'source', data is attached to the traveller's message, and then
  32. the traveller hops down the path, sending the message to each module.  However,
  33. the message need not be sent to an IPCPort, a function address does just as
  34. well -- hence the module method ends up running in the traveller's process).
  35.  
  36. So here is what really happens.  The module invokes a method on its own
  37. process -- DoShadow(CurrentProcessObject(), NULL, METH_PROC_HANDLER, ....);
  38. This method is actually located in the Module_Services program -- the
  39. 'server' in the discussion that Gregory has himself attached to.
  40. It is responsible for the receiving of IPCMessages through the process'
  41. IPCPorts.
  42.  
  43. Now let's say the user adds an element (where an element can be thought of as
  44. an instance of the module under discussion, although this does not strictly
  45. mean a new process is created -- in fact, so far it never means that).
  46. Eventually, a traveller with a bunch of data arrives at the module's
  47. data-function-manipulation-method.
  48.  
  49. If the method is defined as being INVOKE_CALL, then the method is invoked
  50. under the traveller's process.  If the method is defined as INVOKE_SYNC,
  51. then the method is invoked under the module's process (or whatever process
  52. you stick into the mtag_procObject, but let's stick to the module's
  53. that have been written thus far).  If we have the latter case, a message
  54. is sent by the method  invocator (DSM()) to the module process.  Remember,
  55. though, that the module process is -actually- executing code in the
  56. Module_Services program!  The message is passed back into the shadow.library,
  57. and the method gets called by shadow.library by ParseShadowMessage().
  58.  
  59. So you're partially right -- sometimes the traveller does handle data in its
  60. own process.  Often, especially with more complex data manipulation functions
  61. like play, filesave, etc., the method is run in the module's process.  The
  62. former, however, does dramtically cut the overhead of the call
  63. (no IPC/context switching involved).
  64.  
  65. [See below discussion about why GUI process != module process]
  66.  
  67. It's completely possible, of course, to create a totally new process to
  68. handle the data-manipulation method, and with SHADOW V it's even easy to
  69. get one module -program- to create several different processes where each
  70. process defines a "module" to WEB.  [Now you understand why I'm holding
  71. up documenting all of this -- I don't have sample code that does all of
  72. these things yet!  :)]
  73.  
  74. >So, multiple instance issues (as in multiple instances of a game monster
  75. >process), UI issues, configuration file loading and saving and lots more
  76. >aren't even hinted at in the module source except for the attribute
  77. >declarations.  Virtually all of the nasty and difficult ipc and
  78. >process-handling issues that I struggled with before SHADOW pretty much
  79. >disappeared. What was left was that I could concentrate on writing the real
  80. >module software.
  81.  
  82. Let's take UI issues.  Under WEB DA&A, I receive an IPCMessage in my
  83. module's process-context (within the Module_Services program, remember),
  84. to open an element's parameter window.
  85.  
  86. This is converted into a SHADOW method to instantiate the module's
  87. parameter window.  This method in turn sends a method to the GUI, requesting
  88. a window, some gadgets, plus whatever else is necessary (after all, each
  89. module create's a subclass, potentially adding new functionality to this
  90. method -- more later).
  91.  
  92. Each module's class description has a pointer which is initialized to
  93. point to the module's default gadget layout structure (this can be changed
  94. on an element-by-element basis (where element = instance of module), but
  95. this is never done in practice).  This structure informs the GUI (where the
  96. GUI is a separate process from the Module_Services' process -and- the
  97. module's process) where to place the gadgets, what the gadgets are, and what
  98. state variables within the element that that gadget controls.  The window
  99. is created, the gadgets layed out, and the window resized as appropriate.
  100. The gadget's states are also updated from the state variables within the
  101. element's instance data.
  102.  
  103. Let's take, as an example, a simple fileread module.  You would like to
  104. be able to create a fileread which not only opens the parameter window, but
  105. an ASL filerequester as well.  So, along with your usual data_method,
  106. you create an EditParam_method (I forget what these methods are actually
  107. called :().  The EditParam_method is the method that Module_Services calls
  108. when it receives the request to open the parameter window.  The first thing
  109. this method would do is to invoke its superclass' method using the
  110. CallSuper() macro.  Once that returns, the window is verified as being opened
  111. and the ASLObject is created (as necessary) and then opened.
  112.  
  113. What's interesting is that even though the METH_ASL_OPEN  is invoked like
  114. any other method (DoShadow(aslObject, NULL, METH_ASL_OPEN, ....);), the
  115. DSM() function actually -creates- a new, asynchronous process context for the
  116. ASL filerequester, thus allowing asynchronous ASL behaviour and window
  117. behaviour WITHOUT much fuss.  [There actually is some fuss because you
  118. end up passing filename strings to this new process, and there's
  119. actually another method which deals with the synchronous resource tracking
  120. issues that this involves, but this is all within the gui.o file that's
  121. linked into the Module_Services program, so it's at least twice removed
  122. from consideration by module authors.]
  123.  
  124. We won't even get into the multi-level default filename/dirname code that
  125. this approach allows us to use, except to say that there is a lot of
  126. effort to assure users of the modules that directory access-defaults
  127. update in a reasonable manner during program execution.
  128.  
  129. Of course, as all of these classes and instances are PUBLICALLY ACCESSIBLE,
  130. there's no reason why Joe Shmoe can't write a program to traverse the class
  131. list, and then traverse each class' instance list, and invoke the
  132. parameter window method on EACH AND EVERY instance currently running in the
  133. WEB, or patch all of the methods defined in each of the modules for use
  134. in debugging, or many other things that can only be dreamt of at this
  135. time.
  136.  
  137. Great opportunities for environment building, as far as I'm concerned.
  138.  
  139. >As far as I am concerned, this is THE easiest way to handle these types of
  140. >issues (and others I won't go into here). And I know next to nothing about
  141. >object-oriented programming much less SHADOWV! (did I get everything correct
  142. >Dave?)
  143.  
  144. The paragraph, the article, or just that last sentence?  :) :) :)
  145.  
  146. Just kidding!  You hit it pretty close, although what's really nice to hear is
  147. that it's UNNECESSARY to understand all of the intricacies (sp?) of the code
  148. to actually use the interface.  First, because that's one of the objectives,
  149. and second because documenting all of this is going to take some time, as you
  150. can see!  500k of SHADOW docs are just the beginning as far as the WEB is
  151. concerned ;)
  152.  
  153. Plus, I realize that you figure the only way you're going to get a decent
  154. explanation of all of this is baiting me here  :)  You're right too, although
  155. I have finally read and deleted the mid-October discussion about the
  156. file layout issues you were concerned about ;)
  157.  
  158. >Yes, I was sampling stereo at 12.5 kHz, delaying the second channel by about
  159. >500 samples, playing back the results in audio and plotting the waveforms AND
  160. >writing the results to my Quantum 52MB drive throught the FFS filesystem (the
  161. >one that came with my A3000) in realtime. (I can go up to about 17kHz if I
  162. >turn off the waveform plotting and still write to disk in realtime.)
  163.  
  164. Was this on the A4000?  Just curious as to your hardware.  I don't have
  165. a sampler to play with :(
  166. BTB -- I'm bringing my Fujitsu 500M, I decided against the computer as well.
  167. I expect to get some of those samples!
  168.  
  169. >a 12MB stereo sample). Didn't miss a detectable beat in the whole sample and
  170. >quality was very impressive for an 8 bit sampler.  Once I had the file, many
  171.  
  172. Hey, that reminds me that I owe the net an article about bashing the audio
  173. hardware correctly....  Seeing as how I do seem to have that module up
  174. and running correctly ;)
  175.  
  176. >more realtime effects were possible as the system didn't have to be servicing
  177. >that sampler interrupt every 80 us.
  178.  
  179. Eek!  What, I can't play missile-command in the background anymore?  :)
  180.  
  181. >Go for SHADOW V. It's fun!
  182. >(Now how about that kickback Dave?)
  183.  
  184. Okay, okay, I'll REALLY try to change duration to frequency now --
  185. unfortunately, at least on first pass, it's going to make calculations more
  186. difficult, rather than easier (because the GTONE duration has to be
  187. calculated using both the relative frequency differences AND the relative
  188. length differences.  Sigh ;))
  189.  
  190. I hope this is actually useful to the topic at hand, as opposed to just a
  191. long note to Kent [not that he hasn't gotten his fair share in the past] :)
  192.  
  193. David C. Navas                        dnavas@oracle.com
  194. Working for, but not speaking on behalf of, Oracle Corp.
  195.