home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / transput / 1353 < prev    next >
Encoding:
Text File  |  1992-12-22  |  1.7 KB  |  54 lines

  1. Newsgroups: comp.sys.transputer
  2. Path: sparky!uunet!noc.near.net!mars.caps.maine.edu!gandalf!jurlwin
  3. From: jurlwin@gandalf.UMCS.Maine.EDU (Jeff Urlwin)
  4. Subject: Re: Discriminated protocols
  5. Message-ID: <1992Dec22.194412.10650@gandalf.UMCS.Maine.EDU>
  6. Keywords: Occam, ANSI C
  7. Organization: University of Maine, Department of Computer Science
  8. References: <1992Dec21.132719.23839@hubcap.clemson.edu> <rlogin.724966959@dutncp8>
  9. Date: Tue, 22 Dec 1992 19:44:12 GMT
  10. Lines: 42
  11.  
  12. In article <rlogin.724966959@dutncp8> rob@pact.nl (Rob Kurver) writes:
  13. >In <1992Dec21.132719.23839@hubcap.clemson.edu> ka@wan.inf.rl.ac.uk( (Khalid Akram \(student-david;until 31/12/92\)) writes:
  14. >
  15. >>how does one implement discriminated protocols using INMOS ANSI C?
  16. >
  17. >In C (ANY transputer C), you can simply use a union and send that with
  18. >a single channel input/output pair (be they function calls or language
  19. >constructs or whatever).  Unless one member of the union is very much
  20. >larger than the other, and not sent very often, the overhead of sending
  21. >a larger message is usually compensated by the single input/output.
  22. >
  23. >If you find you're transferring too much data this way, you can explicitly
  24. >input/output the union tag first, followed by the right body for the
  25. >tag.
  26.  
  27. Yes, if all your sizes are even close:
  28.  
  29. struct _foo {
  30.     char foo_tag;        /* union tag */
  31.     union {            /* I forget if INMOS C has unnamed unions */
  32.         struct foo1 foo1;
  33.         struct foo2 foo2;
  34.         etc...
  35.     };
  36. };
  37.  
  38. Jeff
  39.  
  40. >
  41. >Rob
  42. >
  43. >--
  44. >     PACT                   Rob Kurver
  45. >    Foulkeslaan 87         rob@pact.nl
  46. >   2625 RB Delft     ph: +31 15 616864 
  47. >  The Netherlands   fax: +31 15 610032
  48.  
  49.  
  50. -- 
  51. --------------------------------------
  52. jurlwin@gandalf.umcs.maine.edu
  53.  
  54.