home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / t / tornado / QandA / Paul1r < prev    next >
Encoding:
Text File  |  1995-06-26  |  11.1 KB  |  194 lines

  1. Quoting DigiLink Email Gateway:
  2.  
  3. >> finish recoding it into assembler. I also need to write a millisecond
  4. >> timer, as blooming Acorn saw fit not to provide one. The most obvious
  5. >> course is to use the IOC latch 2Mhz timer, but this isn't RPC comp. Any
  6. >> ideas?
  7. > Could do one which is accurate to 10ms :).  I've got something here
  8. > somewhere which will do millisecond timing.  Question is, where!  It
  9. > doesn't appear to be on the hard-drive,  so it must be on one of the
  10. > cartridges... Right. It appears to attach itself to IRQ vector and watch
  11. > for IOC/timer1.  Now as there is no IOC in a RiscPC,  the timer has to be
  12. > derived from another source.  I believe that the IOMD can supply a
  13. > suitable ticker,  but without the TRM I don't know what base address it's
  14. > using.  With any luck, it's using the same addr as IOC, but I'd have to
  15. > knock up some code to try it.
  16.  
  17. Emm, it's not hugely important as I was merely thinking it'd be nice if
  18. Tornado would increase timer accuracy past 1cs, mainly 'cos I sometimes need
  19. it. Maybe you could pull this code?
  20.  
  21. >> preemption is inefficiency, as the null return code can't be masked out
  22. >> (ie; the Wimp is always having to page in the task even when it may not be
  23. >> necessary).
  24. > Not sure what you mean about not being able to mask out null's.  Why can't
  25.  
  26. Wimp_PollIdle, if nothing else, will return 0 as a return code. However, it
  27. will _always_ return close as it can to the time specified in R2. The problem
  28. here is that an app with the null code masked out can sit, unpaged in, for
  29. minutes if not being used and thus doesn't take up any of processor time. A
  30. preempted task has two problems: (a) its code must run for a minimum of 1cs,
  31. and the desktop gets /pretty/ shaky when that happens and (b) quite simply,
  32. not only RO but the Wimp has been designed to hinder preempted code. Believe
  33. me, as I've drawn up the protocols and quite frankly, wimp code cannot be
  34. preempted if it is to function properly. That leaves writing our own
  35. multitasker, but the spirit behind Tornado is not this. Tornado isn't intended
  36. to rewrite RISC-OS, but rather replace bad bits of it and add lots more.
  37.    
  38. > you?  If you're worried about too much paging,  then how about initialising
  39. > two apps for each real app.  For example "Impression" might take 600k,  but
  40. > it would mask out *all* events.  The co-app "ImpressionMsg" would mask any
  41. > events it doesn't want,  and pass any relevant ones on to the main app. 
  42. > The message gatherer might take 16k,  so only 4 pages need to be swapped in
  43. > and not 150.  I am assuming that the wimp isn't silly enough to page in
  44.  
  45. Two points to this which makes it impractical: (a) Using OS_SetMemMap is
  46. extremely quick, as it's only MEMC's internal pointers that are being altered,
  47. and no memory is being copied. (b) is you would have nightmares writing an app
  48. that way, as one app is *not* allowed access another app's windows, and so
  49. you'd have to implement a message protocol between the two apps to allow the
  50. master to control the slave's windows. Again, this is verging on impractical,
  51. and never mind that but with subtasks, there are going to be *alot* of tasks
  52. running at once anyway!
  53.  
  54. > It would be nice to pre-empt all applications,  and not force them to be
  55. > written to support it,  but this is a step in the right direction.
  56.  
  57. As I said above, a wimp app cannot function fully under preemption.
  58.  
  59. > Distributed processing is currently a big research topic - there are all
  60. > sorts of problems - mainly associated with machines dying.  If some remote
  61. > machine dies then you don't know if it has executed the function you asked
  62. > it to.  For example if you ask a remote machine to add a record to a
  63. > database,  and it falls over for some reason,  how do you know if the
  64. > record was added or not?  Do you try to run the request again and risk two
  65. > copies in the DB?  Do you assume it was completed and risk the record not
  66. > being added?  I think you should leave the hooks for distributed
  67. > processing,  but don't try to write it for the first release!
  68.  
  69. I dunno about TAOS or anything similar, but Tornado subtasks communicate only
  70. to their parent and their siblings if any. If a child subtask dies for some
  71. unknown reason, or fails to start up, or the subtask being attempted to be
  72. executed isn't really a subtask, Tornado cleans up and returns out of SWI
  73. Tornado_GetSTMessages (used by the parent process to check on the progress of
  74. a subtask and used to receive already processed data) and if the parent
  75. subtask chooses, it may reschedule the subtask, depending on what kind of
  76. error was returned. That's how I intend to get past this. Other subtask
  77. regulations are that the subtask may not be a wimp task, may not use the vdu
  78. drivers, may not save permanent data to a file, and all processed data being
  79. returned either is returned in bits during processing, or in one big lump when
  80. Tornado_ClosedownSubtask is called.
  81.    What do you reckon?
  82.  
  83. >> Anyway, the way I have it is, upon receiving redraw, Tornado calls
  84. >> Wimp_RedrawWindow and Wimp_GetRectangle and stores the current graphics
  85. >> I think this should work.
  86. > When you store the rectangles,  the Wimp will redraw the icons.  Then
  87. > after you have UpdateWindow'ed,  the icons will be drawn again.  Not a
  88. > major problem,  but it should work.  You may need to keep track of new
  89. > rectangles, though.  If something is being dragged accross your window, 
  90. > then you might get new rectangles to redraw before you have redrawn the
  91. > old ones.
  92.  
  93. See my problem with inefficiency? If you want to amalgamate all returned
  94. rectangles while still allowing for the window to be resized, scroll offsets
  95. altered etc then you're looking on some serious processing, and this is in
  96. /addition/ to the 1cs already being taken up.
  97.  
  98. > Do you have to auto compress after each heap op?  Surely you only need to
  99. > do it when you fail to allocate memory:
  100. > * User requests block which is smaller than largest_block.  Allocate memory.
  101. > * User requests block which is larger than largest_block.  Compact heap. 
  102. > If request is still larger,  extend heap or fail.  Allocate memory.
  103.  
  104. :-) _IF_ you had studied the heap data structure more carefully, you'd see
  105. that all reloc and non-reloc blk's addresses are kept in lists. Allocating a
  106. block may increase the size of the list, which may extend the heap to move the
  107. bigger block out, leaving a big hole! This causes major fragmentation unless a
  108. garbage is done. Anyway, the garbage can be optionally disabled, and even then
  109. it would be pretty quick, being written in C and all.
  110.  
  111. >PRM> RISC OS 2 and 3 place strong restrictions on the heap: the base of the
  112. >PRM> heap as specified in R1 must be word aligned and less than 32Mbytes,
  113. >PRM> and the size of the heap must be a multiple of 4 and less than 16Mbytes.
  114. >PRM> In RISC OS 3.5 platforms the only restrictions are that the base of the
  115. >PRM> heap must be word-aligned,  and the size must be a multiple of 4 bytes.
  116. > If they have changed the format,  then they haven't told anyone about it. 
  117.  
  118. Twats! The RO2 heap manager isn't worried about those restrictions either:
  119. It's merely that there wouldn't be enough memory to do this anyway! RO2 & 3
  120. could only ever take a max of 16Mb anyway. And the highest address was
  121. 32Mbytes!
  122.  
  123. >> and reruns itself, keeping the original app intact. When the new app has
  124. > Isn't it a bit wasteful on memory to have two copies of an app loaded at
  125. > once? For example,  Impression Style with no files loaded takes up 600K
  126. > of wimpslot.  This is no problem on a 9Mb machine,  but what about 2Mb
  127. > users?  Here's a possible solution.  Howabout the old app saves all it's
  128. > data into tfs: and the new app then loads it back.  A swi
  129. > "Tornado_ReLoadApp" could do it in the background:  the app saves it's
  130. > data into tfs: and then calls the swi.  The new app is loaded over the
  131. > top of the old one,  and initialised.  When the Tornado App Manager sees
  132. > a Message_TaskStarted it can send a Message_DataLoad to the application
  133. > to force it to load data back from tfs.
  134.  
  135. For a start, it would be strongly recommended that no Tornado app need quit
  136. and reload just because of a config change. I've never had to, and I've seen a
  137. well-written app need to either.
  138.    Add to this, there's virtual memory so a 2Mb owner would merely notice lots
  139. of disc activity. Also, all files and data in apps is *already* contained in
  140. tfs:, if you had fully read the brief. So there would never be a case of two
  141. copies of the same data being in memory, as merely it becomes a case of the
  142. old app passing the handles of the data blocks to the new task. Very easy. And
  143. if an app needs to OS_Find it's files in, which it shouldn't, it can do so
  144. from tfs:.
  145.  
  146. >> Is done. Tornado hooks into Address exception etc. and catches any such
  147. > Hooking on to hardware vectors is not the same under RISC OS 3.5.  Two
  148. > reasons: the module area is now at &2100000.  If you were to assemble the
  149. > instruction "b &2100000" and disassemble it you will find that you've run
  150. > out of bits (dis: b &fe100000).  The second reason is the new processor
  151. > modes with the ARM6 and above - when an exception occurs you get put in a
  152. > 32 bit mode - 26bit code doesn't work in 32 bit modes, so you have to
  153. > switch back to 26bits.  Fortunately there is a swi which can help you:  swi
  154. > "OS_ClaimProcessorVector",  but looking at the docs it seems that you can't
  155. > use the addrex vector (prefetch and data aborts are supported).
  156.  
  157. :-). Hehe, I wasn't planning to overwrite the hardware vectors, but have
  158. Tornado hook itself into the environment handlers. I think this works on the
  159. RPC too? :-)
  160.    Also, any code written specifically for the RPC will use the 32bit mode
  161. /all/ the time. Has to, as it's in the aims that Tornado code should be
  162. superior to other code where possible.
  163.  
  164. > - TFS
  165. > Does not work.  I've assembled it,  and loaded the module.  Typing *tfs is
  166. > fine, but any further * commands (such as *. *info *ex) fail.  They all
  167. > data-abort at &01c02084 - according to my memory map this is near the
  168. > bottom of the system heap (starts at &01c02000).
  169.  
  170. Works okay on RO3.1!
  171.  
  172. > When I try to shutdown the computer,  I get the error FS_Entry Func 16 not
  173. > supported by tfs - I've looked up Func16 in the book and it is just called
  174. > shutdown.  On entry,  r0=16 - I think you can safely ignore this one and
  175. > not bother with the error.
  176.  
  177. This is *BLASTED* RO3+ for you! RO3 Fileswitch does lots of Func16 all the
  178. time, even if they aren't supported (which according to my PRM's it doesn't
  179. have to be really). TFS uses it own method of implementing wildcards, like the
  180. RO2 PRM's say it should. Blasted RO3!
  181.  
  182. > Works,  but garbage collection doesn't appear to be very good.  At the left
  183. > of the bar,  it's mostly white with a few black lines;  to the right of the
  184. > used portion it is mostly black with a few white lines.  The right hand
  185. > side of the heap is completely black (because it's unused).
  186.  
  187. :-) - exactly! For a start, the black lines are actually minute pockets of
  188. small bytes, like eight or sixteen, but the renderer plots them as looking too
  189. big (smallest it can do is one line thick).
  190.    The right is black, and blank, because it's meant to be! In reality,
  191. Tornado would auto-shrink and extend if necessary and the appropriate bits
  192. were set in Tornado_HeapInit. The HeapExt program, which is a prototype,
  193. doesn't implement the full set of Heap+ facilities.
  194.