home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 700s / rfc700.txt next >
Text File  |  1992-10-14  |  15KB  |  332 lines

  1.  
  2. NWG/RFC 700                                                  August 1974
  3. NIC 31020
  4. INWG Experiments Note 1
  5.  
  6.                    A Protocol Experiment
  7.  
  8.  
  9.                        Eric R. Mader
  10.                      William W. Plummer
  11.                     Raymond S. Tomlinson
  12.  
  13.  
  14.  
  15. I.  Introduction
  16.  
  17. In early February, 1974 the main line  printer  on  BBN's  TENEX  system
  18. failed and it was decided to use the PDP-11 line printer via the ARPANET
  19. both for the direct purpose of obtaining listings and also the  indirect
  20. purpose of studying network protocols.
  21.  
  22.  
  23.  
  24. II.  The Basic Protocol
  25.  
  26. The design was based on the protocol described by Cerf and Kahn in  INWG
  27. Note  #39.  Familiarity with that document is assumed.  The following is
  28. a brief sketch of the protocol.  Not  all  features  described  in  this
  29. section have been implemented.  See Section VI.
  30.  
  31. At any instant, the sender has two pointers into the stream of bytes  to
  32. be  sent.   Bytes to the left of the LEFT pointer have already been sent
  33. and acknowledged.  Bytes in the "window"  between  the  LEFT  and  RIGHT
  34. pointers  have  been  sent  (zero  or  more times), but no indication of
  35. successful transmission has been received.  Bytes to the right of  RIGHT
  36. remain to be considered at some time in the future.
  37.  
  38. In operation the sender is constantly sending bytes from the input  data
  39. stream   resulting   in   the   RIGHT   pointer   advancing.    Positive
  40. acknowledgements produced by the receiver cause the  LEFT  edge  of  the
  41. window to move towards the RIGHT edge.
  42.  
  43. LEFT and RIGHT are actually numerical byte  positions  within  the  data
  44. stream.   The low order 16 bits of RIGHT are sent with each message as a
  45. sequence number so that the receiver can identify which part of the data
  46. stream  it  is  receiving  in case messages are not received in the same
  47. order they were transmitted.  The receiver has a finite amount of buffer
  48. space  available  in which it can reassemble an image of the data in the
  49. transmitter's window.  The receiver discards  any  messages  which  have
  50. sequence  numbers  outside of its buffer area.  However, messages to the
  51. left of LEFT must  be  acknowledged  even  though  they  are  discarded.
  52. Otherwise,  a  lost  ACK  would  cause the sender to retransmit (and the
  53. receiver ingore) the message indefinitely.  Messages received  with  bad
  54. checksums are also discarded.
  55.  
  56. As "good" messages are received, the holes are filled in the  receiver's
  57. buffer  and  continuous  segments  at  the  left  edge are passed to the
  58. physical line printer (in our case).  The receiver informs the sender of
  59.  
  60.                                                     Page   2
  61.  
  62.  
  63.  
  64. this  action  by sending an ACK (acknowledgement) message.  This message
  65. specifies the sequence number of the byte it would like to receive  next
  66. (the  new  value of LEFT in the sender) and the current amount of buffer
  67. space it has available (new maximum window width in  the  sender).   The
  68. sender  ignores  ACK's  to  the  left of LEFT and to the right of RIGHT.
  69. Thus, both the sender and  receiver  are  prepared  to  handle  multiple
  70. copies of messages.
  71.  
  72. Failures such as messages  with  bad  checksums,  messages  lost  during
  73. transmission  (data  and ACK's), and messages discarded due to sequences
  74. numbers which were apparently out of range, all manifest  themselves  to
  75. the sender as a dropped ACK.  A dropped ACK will cause the sender's LEFT
  76. edge to stop advancing, leaving the unacknowledged message at  the  left
  77. of the sender's window, and possibly a corresponding hole at the left of
  78. the receiver's image of the window.  Eventually, transmission will cease
  79. and   a  (10  second)  timeout  will  trigger  in  the  sender,  causing
  80. retransmission of all data within the window.  Note that at the  instant
  81. of  a  timeout,  there is no guarantee that the un-ACK'd message will be
  82. exactly at the  left  edge  of  the  window  or  that  it  is  the  only
  83. unacknowledged  message  in  the  window.  Retransmissions are likely to
  84. cause the receiver to see data that it has seen  before,  but  duplicate
  85. messages will be discarded due to sequence number considerations.
  86.  
  87.  
  88.  
  89. III.  "Say Again"
  90.  
  91. An extension to the INWN #39 protocol  which  was  implemented  was  the
  92. ability to let the receiver force retransmission of the entire window by
  93. turning on a flag in any message back to the sender.  This is useful  in
  94. cases  where  the receiver believes that a data message has been dropped
  95. and it wants to force retransmission rather than wait for a  timeout  in
  96. the sender.  Clearly, this relies on the network to preserve ordering of
  97. the messages.  Also, it is not useful if the error rate is high  because
  98. the  whole  window  is retransmitted in order to get retransmission of a
  99. single message or two.
  100.  
  101.  
  102.  
  103. IV.  Establishing an Association
  104.  
  105. In the experiment two flags were used to establish an association.  FRST
  106. (FiRST  flag)  was  the equivalent of SYN described in INWG Note #39 and
  107. served to identify the first message of an association.  This instructed
  108. the  receiver  to  accept  the  sequence  number  in  the  message  as a
  109. definition  of  the  starting  point  of  sequence   numbers   for   the
  110. association.
  111.  
  112. The second flag is a receiver-to-sender  flag  called  HUH  which  is  a
  113. request  by the receiver for a definition of the sequence numbers.  Upon
  114. receipt of a message containing an HUH, the sender responds  by  turning
  115. on  FRST  in  the  next data message.  Normally, HUH is sent only if the
  116. receiver had been restarted, or if it is replying to messages on a  port
  117.  
  118.                                                     Page   3
  119.  
  120.  
  121.  
  122. that it knows is not part of an association.
  123.  
  124.  
  125.  
  126. V.  A Problem
  127.  
  128. A  severe  problem  uncovered  with  the  protocol  was  concerned  with
  129. establishing  an  association.   If  the  PDP-11 (receiver) was reloaded
  130. while the spooler (sender) was running, the first few pages of the  data
  131. stream  were  printed  about  six  times  before  normal  operation  was
  132. established.  The cause was traced to the following sequence of actions:
  133.  
  134.  
  135.           1.   The  sender  would  be  in  a  loop,   timing   out   and
  136.           retransmitting because the receiver had not responded.
  137.  
  138.           2.  Upon being restarted,  the  receiver  would  see  a  whole
  139.           window's worth of messages, and respond to each with an HUH.
  140.  
  141.           3.  For each HUH the sender would reset the window and include
  142.           a  FRST  flag  with  the  first  message  in each of the (six)
  143.           retransmissions.
  144.  
  145.           4.  The receiver would see the  first  message  of  the  first
  146.           retransmission  containing a FRST, accept the sequence number,
  147.           and print the data  from  that  and  the  following  messages.
  148.           Then,  another  message  containing the FRST flag would appear
  149.           and the cycle would repeat (five more times).  Note  that  the
  150.           ACK's  generated in the repetitions were ignored by the sender
  151.           because they were to the left of the window.
  152.  
  153.  
  154. As a "cure" for the above the receiver  program  was  modified  so  that
  155. after  sending  an  HUH, messages are ignored until one with a FRST flag
  156. appears.  This solution is unacceptable in general because it leaves the
  157. receiver  port  useless  if either the message containing the HUH or the
  158. response gets lost in transmission.  Although  a  timeout  was  used  to
  159. guard against this, the timeout cannot be trusted because it might cause
  160. two messages with FRST flags to be received -- just the problem which is
  161. being avoided!
  162.  
  163. An alternate cure which does not depend on the network  to  be  lossless
  164. would  be  to  modify  the  sender  to  respond to a HUH by ignoring all
  165. messages for at least  a  round  trip  delay  time  before  sending  its
  166. response  containing  the  FRST  flag.  This results in having to define
  167. what this time is.  In general this cannot be  done  when  messages  can
  168. become  trapped  for  indefinite  amounts of time in network partitions.
  169. This will be discussed more fully in a subsequent document.
  170.  
  171.                                                     Page   4
  172.  
  173.  
  174.  
  175. VI.  Features not Investigated
  176.  
  177. None of the programs  to  date  have  supported  any  of  the  following
  178. features:
  179.  
  180.  
  181.           1.  Window size control.  The window size was a constant (2048
  182.           bytes).  In a future experiment the window size will be varied
  183.           not only by indications of buffer space in the  receiver,  but
  184.           also as a function of estimated transit time.  (see below).
  185.  
  186.           2.  Reassembly.  Since reassembly is conceptually easy, it  is
  187.           likely to be one of the first extensions.  A message corrupter
  188.           will be included in the receiver to test  the  functioning  of
  189.           the reassembly mechanism.
  190.  
  191.           3.  Expanded Internetwork Addresses
  192.  
  193.           4.  Multiple Associations
  194.  
  195.           5.  Reliable Making and Breaking of Associations
  196.  
  197.  
  198.  
  199. VII.  Implementations Notes
  200.  
  201. The sender involves approximately ten pages of  assembly  code  for  the
  202. network  message interface.  Two processes are involved: one which fills
  203. a buffer by reading the input data stream, and a  second  process  which
  204. sends  network  messages  from the buffer and processes replies from the
  205. receiver.  The two processes are joined by a coroutine mechanism, but in
  206. the future will be two parallel TENEX processes.
  207.  
  208. The receiver program consists of approximately four pages of  BCPL  code
  209. in  addition  to IO device drivers and routines which implement queueing
  210. primitives.
  211.  
  212. Each message contained between zero and 255 bytes of data arranged (as a
  213. coding  convenience) in a way which is directly compatible with the BCPL
  214. string handling routines.  Messages contained a single byte of  checksum
  215. which was the low eight bits of the twos complement negation of the twos
  216. complement sum of all other bytes in the  message.   We  recommend  that
  217. some  more  reliable  checksum  function be employed in the future; even
  218. using eight-bit ones complement arithmetic would be better.
  219.  
  220. Source files for the various programs are available from the authors  at
  221. Bolt Beranek and Newman, 50 Moulton Street, Cambridge Mass., 02138.
  222.  
  223.                                                     Page   5
  224.  
  225.  
  226.  
  227. VIII.  Simple Rate Calculations
  228.  
  229. If we assume that an active association has reached steady  state,  that
  230. processing delays are lumped into the transit time T, and that there are
  231. no errors, then the maximum data rate may be calculated as follows.
  232.  
  233. Assume the sequence numbers being passed by the RIGHT pointer  are  some
  234. function  of  time, R(t).  Messages received by the receiver will be the
  235. same function of time but delayed T (a  transit  time)  seconds.   Since
  236. processing  time  is  zero,  the  acknowledgments  will  bear  this same
  237. function, R(t-T).  Acknowlegements received  by  the  sender  will  have
  238. sequence numbers R(t-2T).
  239.  
  240. Acknowledgements at the sender determine the LEFT pointer, L(t).   Also,
  241. it  is known that R(t) is ahead of L(t) by the width of the window which
  242. is a constant in steady state.  Thus, we have the two relations:
  243.  
  244.                     L(t) = R(t-2T)
  245.                     L(t) = R(t) - W
  246.  
  247. Now, let R(t) = Bt, i.e., sequence numbers are increasing linearly  with
  248. time.  (Microscopically, short bursts will alternate with longer periods
  249. of inactivity, but the average bandwidth will be B.)  The  result  under
  250. the assumptions is that the bandwidth is:
  251.  
  252.                     B = W/2T .
  253.  
  254. That is, the bandwidth in bytes per second  is  just  the  steady  state
  255. window width divided by the round trip delay time.  Conversely, the aboe
  256. relation can be determine the buffer sized needed: in  oreder  for  thee
  257. receiver  to  guarantee  to  accept information that was transmitted, it
  258. must supply buffering equal to (or greater than) the window  size.   The
  259. window size must be equal to or greater than the desired bandwidth times
  260. the round-trip delay time, i.e.  equal to the number of  messages  in  a
  261. round-trip "pipeline".
  262.  
  263. The bandwidth in the presence of a relatively  low  error  rate  may  be
  264. calculated.   Assume  that  B  and  W  are  expressed in terms of (full)
  265. messages rather than byte numbers.  Each error has two effects:  a  time
  266. out  delay  of D seconds and retransmission of W messages.  So, the time
  267. Q(M,N) required to transmit M messages burdened by N errors is  the  sum
  268. of  the  time  to transmit the data once, N*D seconds of time out delay,
  269. and the time to transmit the window N more times.
  270.  
  271.                     Q(M,N) = (2T/W)*M + N*D + N*2T
  272.  
  273. Dividing by M to get time per message and multiplying the last  term  by
  274. (W/W):
  275.  
  276.                     Q(M,N)/M = (2T/W) + (N/M)*D + (2T/W)*(N/M)*W .
  277.  
  278. But (M/N) is just the fraction of messages in error.  Call this E.
  279.  
  280.                                                     Page   6
  281.  
  282.  
  283.  
  284.                     Q(E) = (2T/W)*(1 + EW) + ED
  285.  
  286.                     B(E) = 1/[(2T/W)(1+EW) + ED]
  287.  
  288. The advantage to using the "say again" mechanism (Section III.) can  now
  289. be seen: it forces D to be zero, allowing a reasonable average data rate
  290. in the presence of errors.  Note the effect of a 10 second time out on a
  291. network  with  an  E  of 0.01, assuming W to be 20 messages and T of 0.5
  292. second.  B(D=10) is 6.7, but with forced retransmission, B(D=0) is 20.
  293.  
  294.  
  295.  
  296. IX.  A Sequence Number Consideration
  297.  
  298. In order to reject duplicate messages, sequence numbers must  contain  a
  299. sufficient  number  of  bits such that it is impossible to cycle through
  300. more than half the sequence  number  space  in  a  message  lifetime  at
  301. maximum transmission rate.  Assuming a 1 MegaByte per second network and
  302. a maximum lifetime of 500 seconds, the sequence  number  field  of  each
  303. message must be capable of holding the number 2*500*10**6 which is 10**9
  304. or about 2**30.  Thus,  a  32-bit  (4-byte)  sequence  number  field  is
  305. recommended.
  306.  
  307.  
  308.  
  309. X.  Additional Control Functions
  310.  
  311. In response to an attempt to establish an association (SYN) it  is  felt
  312. that the receiver should be able to deny the attempt (RELease) in one of
  313. the following three ways:
  314.  
  315.           REJECT.  (I'm busy.  Try again later.)
  316.           ABORT.  (I don't understand what you are sending.
  317.                     (Bad port, etc.))
  318.           ABNORMAL (SYN arrived on a established connection.)
  319.                     (Receiver breaks connection and issues this REL.)
  320.  
  321. During an established association, the sender should be able to  RELease
  322. the association in either of these ways:
  323.  
  324.           DONE.  (I'm done sending to you.)
  325.           GAG.  (Stop.  You are sending garbage (ACK's).)
  326.  
  327. These may be coded as combinations  of  bits  in  the  FLAGS  which  are
  328. convenient for programming.
  329.  
  330.  
  331.  
  332.