home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / amiga / programm / 15756 < prev    next >
Encoding:
Internet Message Format  |  1992-11-12  |  3.8 KB

  1. Path: sparky!uunet!gossip.pyramid.com!pyramid!cbmvax!bagate!rutgers!uwvax!zazen!doug.cae.wisc.edu!umn.edu!csus.edu!nextnet!wittb
  2. From: wittb@nextnet.csus.edu (brian witt)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: How to program multi-threaded programs on Amiga ?
  5. Summary: Try one prcess higher priority
  6. Message-ID: <1992Nov12.195317.19859@csus.edu>
  7. Date: 12 Nov 92 19:53:17 GMT
  8. References: <1992Nov3.192244.15235@jato.jpl.nasa.gov> <d9hh.720829520@dtek.chalmers.se> <1992Nov9.185443.2011@jato.jpl.nasa.gov>
  9. Sender: news@csus.edu
  10. Organization: California State University Sacramento, USA
  11. Lines: 74
  12. Cc: uunet.uu.net!dtek.chalmers.se!d9hh
  13.  
  14. In article <1992Nov9.185443.2011@jato.jpl.nasa.gov> you write:
  15. >In article <d9hh.720829520@dtek.chalmers.se> d9hh@dtek.chalmers.se (Henrik Harmsen) writes:
  16. >>Yes, I know, Intuition has a buffer for all the messages that it wants
  17. >>to send me, but when you have a humungous amount of messages this buffer
  18. >>quite easily overflows.
  19.  
  20. Message ports don't have a buffer limit.  Because there is no memory
  21. protection and Exec lists have no upper limit, you can exhaust all
  22. memory with messages attached to a message port.
  23.  
  24. However, I realize you probably also want some sort of low proiorty/
  25. high priorty scheme to handle the mouse and to handle screen updating.
  26. You may want to try this (but you may be flamed).
  27.  
  28.     Open libraries and such first off.
  29.  
  30.     Create a private message port and pass it to a new process
  31.     that's running in your code space.  The new process waits for
  32.     work on the private message port.  This process will handle
  33.     lower-priority duties (like word wrapping).  It might also
  34.     manage other project (not current window) that your application
  35.     has opened.
  36.  
  37.     Have your initial process boost its priority by one.
  38.     This way it will respond quickly to any intuition messages.
  39.  
  40.     Have the initial process open all windows, screens, etc.
  41.  
  42.     In the main processing loop for the window, all messages
  43.     are recieved and delt with.  Those requiring instant response
  44.     delta with immediately.  Message of background usefulness
  45.     are SendMsg() to the private port; don't change the ReplyPort!
  46.  
  47.     When the initial, priority boosted process is idle, the rest of
  48.     the system will operate, including the second process.
  49.  
  50.     At exit time, send the low priorty process a kill message.
  51.     Then loop with a sleep() call until some global varaible is
  52.     set to indicate OK to die.
  53.  
  54.     Cleanup gracefully and exit to AmigaDOS!
  55.  
  56. Good modular programming should make things easier to code.  You
  57. may need some semphores in the case where the normal priority process
  58. is changing a data structure when Intuition (running at high priority)
  59. sends an important message to your window, which is handled by
  60. a high priority process.  The background process is interrupted
  61. while your importnat message is handled to completion. (Can you say
  62. 'concurrency' and 'deadlock avoidance' -- knew ya could.)
  63.  
  64. Note: This may degrade overall system performace for other programs, but if
  65. the user is concentrating on your program, then it *shouldn't* matter if
  66. other programs are running a little slower... (maybe)
  67. (Windows/NT at the Fall 1991 Comdex did something like this.)
  68.  
  69. >>I also want to use more than one (two, three..) processes for other things.
  70. >>It would be nice to be able to edit one text while you process another :-)
  71.  
  72. >Jeff
  73.  
  74. My knowledge goes up to ADOS 1.3 as I still have (and am typing on) an
  75. Amiga 1000  !!!!!!!!!!
  76.  
  77. PS:  I'm looking for an Amiga 1000 ethernet adapter and a 68020 with MMU
  78.      and memory plug-in (used OK).
  79.  
  80. --- American Culture:  Cigarettes and Alcohol
  81. --- brian witt
  82.  
  83. -- 
  84. ============================================================================= !
  85.    Brian Witt   Sac State Computer Science]   "Waldo, the pariot, is dead"
  86.    Internet:  wittb@ratserv.ccs.csus.edu              -- Agent Cooper
  87.                 #define  POSIX_ME_HARDER     1       <-- GNU
  88.