home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / amiga / programm / 18136 < prev    next >
Encoding:
Text File  |  1993-01-05  |  6.6 KB  |  135 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!paladin.american.edu!gatech!usenet.ins.cwru.edu!agate!spool.mu.edu!umn.edu!csus.edu!netcom.com!jazz
  3. From: jazz@netcom.com (David C. Navas)
  4. Subject: Re: IPC and shared memory
  5. Message-ID: <1993Jan5.013353.1328@netcom.com>
  6. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  7. References: <Jean-Guy_Speton.056u@tvbbs.wimsey.bc.ca> <TOO.92Dec31145940@laphroaig.cs.hut.fi>
  8. Date: Tue, 5 Jan 1993 01:33:53 GMT
  9. Lines: 124
  10.  
  11. IPC and shared memory?  My ears are burning!  :)
  12.  
  13. In article <TOO.92Dec31145940@laphroaig.cs.hut.fi> too@laphroaig.cs.hut.fi (Tomi Ollila) writes:
  14. >In article <Jean-Guy_Speton.056u@tvbbs.wimsey.bc.ca> Jean-Guy_Speton@tvbbs.wimsey.bc.ca (Jean-Guy Speton) writes:
  15. >
  16. >   I am looking for information on inter-process communications (IPC) and
  17. >   shared memory functions.  Do the Amiga libraries have any functions along
  18.  
  19. Boy, have you come to the right place.
  20.  
  21. >   I have a few ideas in mind, but they all
  22. >   seem as if they will become extremely slow and inefficient with more than a
  23. >   few lines.
  24.  
  25. Depends on what you're trying to do.  If you're trying to send messages with
  26. a character at a time between 10 different processes, yes, you're going to have
  27. a little bit of trouble ;).  If you're doing something easy, like line-IO or
  28. IO streams that are updated on something like a 10ms clock, then no problem.
  29.  
  30. >I'd imagine that the most efficient results are achieved by using shared
  31. >libray, and returning different base pointer for each OpenLibrary() call.
  32.  
  33. Ieu, ick :)
  34.  
  35. >achieve fast IPC. Using Pete Goodeve's ppipc.library along w/ your
  36. >functions makes your code more safe against sudden deaths (without closing
  37. >your library) of some process using your library.
  38.  
  39. Yes, I use Pete Goodeve's ppipc.library.  That's part of the reason why I
  40. followed-up to this article, instead of the other five on the topic I have
  41. here.
  42.  
  43. For ANY AND ALL IPC and SHARED MEMORY concerns, I highly recommend at least
  44. looking at shadow.library.  SHADOW V is available via ftp from the physik
  45. mirrors as shadow5.0.lzh.  This archive includes about 500k of Documentation,
  46. so even if the library itself doesn't interest you, you might get some ideas
  47. from reading the Docs and looking at the (rather messy) example programs.
  48.  
  49. So what is included with SHADOW V?
  50.  
  51. A quasi-object-oriented scheme (accessed using C and/or assembler) which
  52. allows each method within an object to be run synchronously to the invoking
  53. process, synchronously to a specific process, synchronously to a specific
  54. -named- process [need not be running when class is created], synchronously
  55. to a -class- of processes (processes are objects too!), synchronously to
  56. a process which is created at method invoke time, or....
  57. [breathe]
  58. Each method can be patched at runtime, so that you can change/modify how
  59. methods within classes at at runtime, and (sometimes more importantly)
  60. get copious amounts of debugging data (who calls what methods and when).
  61.  
  62. A semaphoring system that supports the usual R/W semaphores included with
  63. Exec along with counting semaphores, condition variables, level-triggered
  64. semaphores, etc.  Semaphores need not be pre-created as with Exec
  65. semaphores (ie: there is no user-accessible equivalent to the SignalSemaphore
  66. structure within Exec).
  67.  
  68. Semaphore-protected access to AVL Tree structures (AVL ~= Binary if you haven't
  69. read about them yet).
  70.  
  71. Object resource-tracking.  Each object can belong to a specific task, and when
  72. that task quits, the object will be requested to go away.  Each object has
  73. a usecount associated with it and will NOT go away until the usecount
  74. goes to zero.  Several functions provide access to this usecount -- complete
  75. information within the Documentation itself.
  76.  
  77. WatchedVariable construct which allows other tasks to receive methods when
  78. the variable changes state.  WatchedVariables can exist within objects,
  79. in which case it is possible to "watch" -every- object's variable for
  80. state changes with a single "watcher" object (called Directors in the
  81. Documentation).
  82.  
  83. Many other things which I'm probably forgetting.
  84.  
  85. What does it all mean?
  86.  
  87. It means you can have scads of different programs which can invoke each other's
  88. functions with or WITHOUT a process context switch.  The removal of the
  89. overhead of a context switch is often EXTREMELY important.  Hence shared
  90. libraries.  SHADOW is shared libraries on steroids.  :)
  91.  
  92. Is all of this true, really?
  93.  
  94. Well, I'm currently writing a LOT of modules for a data acquisition and
  95. analysis package.  These modules are all subclasses off of a "master module".
  96. Hence, gadget layout routines, state handling (for handling command-line,
  97. WB, Arexx, etc. arguments), event-loop handling, etc. are ALL handled by a
  98. COMPLETELY DIFFERENT program, even though many of these routines happen to
  99. run within the context of the calling module.
  100.  
  101. For example, the event-loop for each of the created modules is located within
  102. the "master module".  However this METH_PROC_HANDLER method is invoked
  103. synchronously to the caller.  For comparison, the PAUSE methods (if I
  104. remember correctly) run asynchronous to the caller (usually the GUI) and
  105. synchronously to the  "master module";  the GUI methods all run in a
  106. separate GUI process (synchronous to a GUI Process type in many cases); and
  107. the ASL filerequesters all run as auto-invoked processes so that neither
  108. the calling module, nor the calling GUI process are hung waiting for the
  109. ASL requester to return.
  110.  
  111. The differences between these types of methods are handled by a few flags
  112. within the MethodTag descriptor.  It sounds complicated, and sometimes the
  113. number of data structures (ARGUMENT_TAGs, ATTRIBUTE_TAGs, METHOD_TAGs) can
  114. be annoying, but difficult and code-intensive it is not....
  115.  
  116. Because the code need not be included with each of the modules, the modules
  117. end up taking around 5k of space each (SAS/C 6.1 w/o optimizer), and then
  118. only because they have to support four separate data types (char, word, float,
  119. double).
  120.  
  121. Let me know if you don't have ftp access and I'll do my level-best to get a
  122. copy of SHADOW V to you.  If nothing else, you have similar problems to me,
  123. and perhaps the 500k of Docs I've written will spark some of your own thoughts.
  124.  
  125. BTW -- I know that sending $20 shareware fees (for includes and link-libs)
  126. is expensive for folks overseas -- if anyone overseas is interested, but is
  127. held back by the $20 fee, do not hesitate to contact me through my
  128. jazz@netcom.com account -- I have some thoughts for the first two or three
  129. people, anyway....
  130.  
  131. -- 
  132. David Navas                                       jazz@netcom.com
  133.                         dnavas@oracle.com
  134. "If it wasn't for the fact that I worked so hard, I'd be a very lazy person."
  135.