by carl malamud treams emce - public.resource.org · 2017. 9. 23. · not a net ork component, but...

5
-- --- - -------- - \Fn\()Hh PH()(.I{ \\1\11\(, - - --- -- - - - By Carl Malamud ow emce treams As Part of AT&T's Unix System V, Streams Delivers a Standard Set of Communications Interfaces and Programming Tools that Gives Network Programmers a Modular Approach to Complex, Layered Protocols .. II1II1 n the Dark Age of data commu- nication , net orks were ju t another program, adjunct to a general-purpose operating sy tern, like a word proce sor or a .... graphic routine. But in today' network-inten ive environment, that' no longer the ca. twork-based applica- tions are on the way to becoming the norm, and the network itself ha become another operating sy tern support tool, like file y terns, lock managers, and CPU scheduling mechanism . With the advent of layered communi- cation protocol, howe er, the ituation ha grown decidedly more difficult. The very complexity of the protocols d - mands a framework that allows them to be implemented in a modular fashion, thu making it pos ible to build up sophis- ticated communication services from impler building blocks. E sentially, a framework of this sort need to furnish a t of standard interfaces between the modul 0 that one module need not know the details of its neighbor. Once written, these module can be used over and over again ift different combinations, giving network programmers a highly portable, ea ily reusable t of r ources. For instance, it' po ible tE> arrange the protocol tack so that X.25 (implemented as one or more modules) can be located imultaneously under the network layer of both TCP/IP and OSI. In the Unix world, upport for net- work operations comes through Stream , which is included as a standard part of AT&T' Unix System V. Streams itself is not a net ork component, but a frame- work that makes it ea .r to implement communications-based services. Streams i not the only uch mecha- ni m, of course. But it presence in Unix makes it a factor in many key products: Sun Micro ystem Inc.' and AT&T' Unix, Digital Equipment Corp.' Ultrix, and IBM' AI X, for example. Other ven- dors, such as ovell, also are adopting treams for their operating systems. In its broadest n e, Stream is a tandard set of communication inter- faces and programming tool that reside in the operating tem kernel. It pro- vides a way of pa ing me sages first be- tween an application program and a net- work protocol stack and finally to a network interface card. One of the prime advantages to a mechanism like Stream is that it ensures portability by establishing a standard pro- gram interface to operating sy tem re- Sources. ving a Streams-based appli- cation to another em can be as imple a recompiling it (and for binary compati- bility, it' not even necessary to recom- pile). True, this ideal i not al ay real- ized, but it is the goal. The other advantage i interopera- bility, easily seen in the interaction be- tween an application and the network. Many application directly invo e the ser- vices fumi bed at the net ork transport layer, providing reliable, end-to-end com- rnunicatio . Streams upplies a way for an application to bmit I to a transport module. If network designers write their modules so that all accept the same types of g, the application program' able to choose the appropriate transport tack for the job. The same message (for example, " E CONNEC- TION") can establi h a connection on TCP/IP, OSI's TP, and Novell's SPX transport modules. Coupled with Streams are ts of tandard message definitions. In the ca of the transport layer, the Transport Pro- vider Interface (TPI), also a part of Unix Sy tern V, de the m Ie that a transport module can accept and act upon. Thus, any TPI-compliant transport DATA COMMUNICATIONS 0 MAY 1990 0 ..

Upload: others

Post on 21-Jan-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: By Carl Malamud treams emce - Public.Resource.Org · 2017. 9. 23. · not a net ork component, but a frame work that makes it ea . r to implement communications-basedservices. Streams

- - --- - ~- -------- - \Fn\()Hh PH()(.I{ \\1\11\(, - - --- -- - - -

By Carl Malamud

ow•emcetreams

As Part ofAT&T's Unix System V, Streams Delivers aStandardSetofCommunications Interfaces and ProgrammingTools that Gives Network

Programmers aModular Approach to Complex, Layered Protocols

..II1II1 n the Dark Age of data commu­nication , net orks were ju tanother program, adjunct to ageneral-purpose operating sytern, like a word proce sor or a

.... graphic routine. But in today'network-inten ive environment, that' nolonger the ca. twork-based applica­tions are on the way to becoming thenorm, and the network itself ha becomeanother operating sy tern support tool,like file y terns, lock managers, and CPUscheduling mechanism .

With the advent of layered communi­cation protocol, howe er, the ituationha grown decidedly more difficult. Thevery complexity of the protocols d ­mands a framework that allows them tobe implemented in a modular fashion,thu making it pos ible to build up sophis­ticated communication services fromimpler building blocks. E sentially, a

framework of this sort need to furnish at of standard interfaces between the

modul 0 that one module need notknow the details of its neighbor. Oncewritten, these module can be used overand over again ift different combinations,giving network programmers a highlyportable, ea ily reusable t of r ources.For instance, it' po ible tE> arrange theprotocol tack so that X.25 (implementedas one or more modules) can be locatedimultaneously under the network layer

of both TCP/IP and OSI.In the Unix world, upport for net­

work operations comes through Stream ,which is included as a standard part ofAT&T' Unix System V. Streams itself isnot a net ork component, but a frame­work that makes it ea . r to implement

communications-based services.Streams i not the only uch mecha­

ni m, of course. But it presence in Unixmakes it a factor in many key products:Sun Micro ystem Inc.' and AT&T'Unix, Digital Equipment Corp.' Ultrix,and IBM' AIX, for example. Other ven­dors, such as ovell, also are adopting

treams for their operating systems.In its broadest n e, Stream is a

tandard set of communication inter­faces and programming tool that residein the operating tem kernel. It pro­vides a way of pa ing me sages first be­tween an application program and a net­work protocol stack and finally to anetwork interface card.

One of the prime advantages to amechanism like Stream is that it ensuresportability by establishing a standard pro­gram interface to operating sy tem re­Sources. ving a Streams-based appli­cation to another em can be as implea recompiling it (and for binary compati­bility, it' not even necessary to recom­pile). True, this ideal i not al ay real­ized, but it is the goal.

The other advantage i interopera­bility, easily seen in the interaction be­tween an application and the network.Many application directly invo e the ser­vices fumi bed at the net ork transportlayer, providing reliable, end-to-end com­rnunicatio . Streams upplies a way foran application to bmit I to atransport module. If network designerswrite their modules so that all accept thesame types of g, the applicationprogram' able to choose the appropriatetransport tack for the job. The samemessage (for example, " E CONNEC­TION") can establi h a connection onTCP/IP, OSI's TP, and Novell's SPXtransport modules.

Coupled with Streams are ts oftandard message definitions. In the ca

of the transport layer, the Transport Pro­vider Interface (TPI), also a part of UnixSy tern V, de the m Ie that atransport module can accept and actupon. Thus, any TPI-compliant transport

DATA COMMUNICATIONS 0 MAY 19900 ..

Page 2: By Carl Malamud treams emce - Public.Resource.Org · 2017. 9. 23. · not a net ork component, but a frame work that makes it ea . r to implement communications-basedservices. Streams

--- - - - u -- -- - \1'T\\()I<h PH()(,I<\\l\ll\t. - ~- ---- - -

Stream

head, modules, and driver. The head con- for a particular et of modules andlain a set of routine that communicate drivers.between the operating system and the apo Streams' message-handling capabili­plication and the re t of the tream. The ties also provide a more advanced ap-tream head and driver are connected proach to 110 proc . . Aprogram can

automatically hen the device i opened. is ue a PUT function call, which alerts theIn other ords, a tream is opened just as stream head that data from some locationa file would be. When the node represent- in memory i to be sent downstream. Theing the device on the file y tem is head gets the message from user (appli­opened, th device driver i connected to cation) memory, which consists of twothe tream head. Module can then be parts, control and data.added to the tream. tandard operating The control part of the message indi-y tern calls can be u ed to open and cates what kind of message is being sent.

clo the tream. The data part i hat the interpreter ofIn addition to standard 1/0 opera- the me sage will u . ormally, the pro­

tion such as READ and WRITE, the gram generates protocol messages thattream head supports additional com- are interpreted by module on the

mands. T 0 important ones are PUSH stream, modified, then sent along to theand POP, hich add and remove modules next module or driver.from a tream. When the stream is For example, the top level of theopened for the first time, it actually con- stream might be a transport layer thatsists of a head and driver. The user pro- upplies service primitives to send andgram can then PUSH modules onto the receive data. When the transport layerstack, in between the stream head and receive a message, it ould add thethe driver. Additional modules are transport header, the sequence numberPUSHed between the stream head and of the message, and any flo -control in­the highest-level module. formation for the remote node on the

To add a module onto the tack, the network.programmer issues an IOCTL call, giving The transport module ould thenthe PUSH argument and giving the ad- send the e to the net ork mod ,dress of a module that will be added to hich ould add the De ork-level bead­the stream. POP would be used to delete er containing routing information. Then,a module. PUSH and POP are exam or the message ould be handed off to theargument that the fream head deals device driver, in this case a network in­with directly. But if IOCTL ha an un- terface card. The data link informationknown argument, the tream head will ould be added to the message, and thegenerate a mes- message ould besage and send it nt onto the LAN.do tream. At the remote

When the end, the rever eu send a com- ould occur. Anmand to the Ethernet driver,tream head, it for . , woukl

tat the data and receive the mepackage it as a da am aDdm e. The first package it into amodule down- Streams message,tream from the head examines the mel- hich ouId it to the net ork

sage and decid if it will take action. If it layer. The ork-layer module oulddoesn't recognize the message, it will strip the routing header and hand thepass it to the next module. The ability to me age to the tran port layer. The

unknown paramete m traDsport module ouId determiDe thedo tream instead of generatiDI an er- traDsport layer addr check theror me ge to the calling program queoce of the m , aDd then hand itmU Streams easily extensible. . back up to the tream bead, which ouIdStreams are de6Ded in the deliver· to the user proJraID....

Str interface. Others be defiDed Each Streams componentneeded. The TPI· an example of a of mes:saae queues, ODe for •.::oIDIIDi

upp tal of defiDecl , the other for ou .

module can service such me ages,thereby establi bing a protocol-indepen­dent interface to the application.

Stream provides the framewor forinteroperability; standard interfacesmake that frame or 1 reality. e orkprogrammers-the people ho developdataba s and scheduling and conferenc­ing systems-an thu concentrate ontheir work and not worry about the m ­chanics of the lower layers of thenetwork.

The Streams specification com­prise a collection of system call , func­tion calls, kernel resources, and kernelutility routines. The primary facilitie thatit offers are buffer management, flowcontrol, scheduling, multiplexing, a yn­chronous operation, and error and tracelogging.

Every individual stream consists ofa tream head and a driver, bet een

hich module can be placed. The driveri the end of the stream (see Figure 1).The tream head i a set of routine thate tablishe the interface to the re t ofthe y tern. WRITE and IOCTL (1/0 con­trol) requ ts are turned into messagesand sent to the tream. Read reques incomparison, take data from the streamand pa it to the user. The modules pro­ce s messages transmitted between atream head and driver.

The be t way to understand Streamsi to tart with the ay 110 proces ing isdone on a local computer. Any device(say, a network interface card) that· ac­cessed by an application has a device driv­er. Each device driver has a set of c0m­

mand that ignal the type of operation tobe performed. Stream comes into thepicture by providing the common inter­face to the network card or to any otherdevice.

.Traditional device drivers are basedon a character 110 mechanism that letsusers read or write one character t atime. Stream operates in the same man­ner, but it also allo users to dispatch anentire message to the device driver forprocessing. The message· placed in aqueue until the driver is ready to procesit This m e 110 feature· ODe of thefacets of Streams that makes it particular­ly ell suited for the ne ork enviroo­men!, here a shared medium makes

es more efficient than seodin& .gle cbaracten.

As DOted. a stream consists of a

OOATA :TlONSOMAY 1990

Page 3: By Carl Malamud treams emce - Public.Resource.Org · 2017. 9. 23. · not a net ork component, but a frame work that makes it ea . r to implement communications-basedservices. Streams

-- - --- ---- ---- \1'''\()I~h PH()(.\{\\1\II\(, - - -- -- - - --

Stream

treams baring the multipl xing moduleor verallo er tream under the con­trol of the multiplexing module.

ultiple lower tream are createdby first opening two parate tream,one con . ling of the stream head and

multiplexing module, and the other, atream head and driver. xt, the 10 ertream i connected to the multip xing

driver u . I-U K command, hich. tructs the 10 er module to send allupstream data to the multiplexing mod­ule. An data from the multiplexing mod-

JlONS 0 MAY 1990UlODATACOM

g (see Figure 2). The qu ueslish Bow control to prevent roes gfrom overloading a module or driver.Th y also expedite data rvices.

Of th 0 me g qu u ,on ifor upstream roes g ; the other i fortho e headed down tream. The qu uesare imply area of memory managed by amodule larg enough to hold several me -

ge . When a modul nd am ssagedown tream, it invoke the PUT proc ­dure of it down tream modul . Thi al­10 a modul to pa m sag to thenext module b placing it in a queue forproces ing. The PUT procedure examinthe me sage and decides if it needs imme­diate servicing. Ifnot, it will PUT th mes­sage onto the queue.

The queue itself con i ts of a riesof linked mes es. The head of thequ ue point to the first message, hichin tum contains the addr of the nextm sage. The la t me sage, or tail of thqueue, has a pointer back to th head.

Normally, amessage i PUT in th tailof the queue and the pointer is adju ted topoint to the qu ue head. But certain ciae of m sag (those 'th high-prioritytatu ) are not ubject to flow control and

are added not to the tail but to the head,behind any exi ting high-priorityme sages.

Besides the PUT procedure, aStreams modul also has a service proce­dure a sociated with it. It is scheduled toexecute whenever there is ork to bedone, and it periodically emptie thequ u of all m ges. At time ,a modulewill be unable to send a message becauthe downstream module is unable to pro­c it. When this occurs, the stream isblocked. If the do nstream queue iblocked, the local module may not be ableto empty its own queue, bringing thestream to a halt until the downstreamqu ue' unblocked.

In most computing envirOlllDeDts, it. necessary to hare drivers among mUl­tiple u r, hich can be accomplishedthrough the Streams multiplexer. Atrans­port-layer protocol uch Tep . u~

port multiple and' a good candi­date for multip ed Stream .

Amultiplexed tream' actually t 0

or more streams stac ed atop one anoth­er ( F'tgUre 3). The multiplexing mod­uIe' used to route data to the appropri­ate tream. Multiplexing can take place ineither direction, ith everal upper

Page 4: By Carl Malamud treams emce - Public.Resource.Org · 2017. 9. 23. · not a net ork component, but a frame work that makes it ea . r to implement communications-basedservices. Streams

treams

,. ;~ ~. ..', "' .

"'. . • ~ •)~." '~.: . .-, .'" .. : ~ . loy.: "~

; ... # • - ••

- .•. "'. ~.... ". ~.... ~ .

that are recognized by differ nt tran portlayer modules. The Tran port Level In­terface (TLI) provide a functional inter­face to the TPI, WID h is th actual mes­ag format under tood by the transport

protocol . Thus, the TLI library tran ­late a function call request for a trans­port ervice into a TPI me sage to use

the service provided by th underlyingprotocol.

A TPI-compliant transport levelmodule will rvi e any application layerprogram that uses the TLI interface. In­tead of programming directly to oven'

SP , for example, the programmerwrites an application that use the TLIlibrary call. t run time, the program canbe run u ing PX,O I, or TCPIIP proto­col tack. It's thus po sible to changethe underlying tran port mechani mwithout rewriting program . And inceTLI ha been adopted by so may vendor ,the net ork components of a programhay become very portable.

ill consi ts of t 0 components: aill library and a ill module ( rlg­ure "). The hbrary is linked into the ap­

. . program and becomes a upportmuch in the same y remote

procedure caD (RPC) hbraries are linkedto application. The ill library aceenl in the main body of the pr0­gram and performs the required opera­

to deli er a message to the stream

The TU module· PUSHed OIl 0 theit· It then p

requleStI from and trof into standard TPI

mes!iiqeS,. The TU library aDo a pr0­grammer to develop network-based pro­grams without orrying about the type oftransport tack being used. For example,a programmer can issue a T-CO CTfunction caD to open a connection on anysupported transport tack.

The T-CO ECT can is translatedinto a T-CO -REQ (tran port cODDeCtionr t) bich i passed downto the transport provider, a module thataccepts TPI .the rvices OIl a particular network. TheTU module . until it receiv aT-CO -CO (transport CODDection con­firmed) &om the transport provider.At that point, i~ returns the information tothe stream bead, which fills in the addressof the remote connection.

A . variety of iPI me es(and corresponding function calls) havebeen defined for Streams, including errorhandling and expedited data. hich fur­ther extend the usefulnes of theStreams programming interface. The hi-. fuoctiooaIity is the as if a~

grammer ere writing directly to thetnDsport layer. The advantage of tbi

Page 5: By Carl Malamud treams emce - Public.Resource.Org · 2017. 9. 23. · not a net ork component, but a frame work that makes it ea . r to implement communications-basedservices. Streams

....-'. a contributing editor toDATA CO CATIO s. TIn article·an excerpt &om . fortbcominl boo A..•4lpi1v Nt1MJ NIIrItwts (Van traDdReinbold, 1990).

111.".". 10 I"g Arl s.~sniIz tI/AT~T &U~ ftw lIis"." tiM COJIIMftIs.

\ I 1\\ ( 11\" P1\ ( )( 11\ \ '1\ II \ (,

approach is implicity and uniformity: Aprogrammer u one approach to net·work programming, regardles of thtype of net or .

In e, Streams alIo a~grammer to a toolbox of capabiliti :TU tools, for example, make it pos ibleto t up connection easily. The fact thatthe connection i over TCP/IP, OSI,DECnel, or veil SPX i irrelevant tothe application programmer.

TU hield the programmer fromthe intricacies of transport providers. Up­per-layer providers, uch as RPC , can beput into thi frame ork with ease.Net . , for example, u Streams andnl to tie i RPC technology into~veil' et are and other net orkarchitectur

AT

Astrocom Corporation

As "23 DSUI U ead to LPDA-2' smooth and traight

The trocom 2300 DSU/CSU Plus, it's attracti ely priced andwith the LPDA-2 option offers backed by~ rt mce.everything you need for complete For the mooth and straight roadNetView'" compatibility. to LPDA-2, call: (612) 227-8651

All the diagnostic optio .The easy DDS access.

The variable speed 2300 DSUIC>U supports speeds of2.4, 4.8, 9.6,19.2 and S6K bps. RS232 and V.3Sinterfaces are co-resident Thiscombination provides the flexibilityto reconfigure your network without

. changing the DSU/CSU.