Sei sulla pagina 1di 6

1

Washington
WASHINGTON UNIVERSITY IN ST LOUIS
Project:
Protocol Development Framework
for Virtual Networking
Fred Kuhns
Computer Science and Engineering
Applied Research laboratory
Washington University in St. Louis
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 2
Layered Protocol Stacks
HTTP
TCP
IP
Ethernet
netscape
HTTL
TCP
IP
Ethernet
Apache
Host A Host B
HTTP: get url
HTTP: response:
get page
html document
TCP: port, ctl, PDU
TCP: port, ctl, PDU
IP: addr, type, ctl, PDU
IP: addr, type, ctl, PDU
Ether: MAC, type, PDU
Ether: MAC, type, PDU
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 3
Layers Architectural Pattern
protocols are a set of processing rules and data
formats that describe how entities may communicate
format, content and meaning of messages are defined
routing (finding participants) and forwarding must also
be defined
layers correspond to abstractions with the lowest
layer concerned with the representation of bits on the
physical medium.
OSI defines a 7 layer model: application, presentation,
session, transport, network, data link and physical
2
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 4
Layering
Context: Large system requires decomposition
Problem: complexity the problem domain can be
divided into both horizontal and vertical concerns.
vertical: must address both low-level issues such as how 1s
and 0s are representing on the physical medium and high level
issues such as object representation, addressing and routing.
horizontal: communication often must traverse multiple
devices in its journey from sender to receiver. The messages
may traverse networks implementing different protocol suites
requiring bridges and gateways.
Solution: structure solution in layers with each layer
exporting a set of services to the layer above it.
Each layer shields lower level layers
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 5
Issues for Framework Developers
For each layer:
Specify services
Specify interfaces : consider facade pattern
Communication between layers: push versus pull model or the
publish-subscriber and Pipes and Filters patterns. Try
callbacks or the command pattern.
Layer coupling: for example one-way coupling where a layer
knows about the layer below but not above. Command pattern
and Reactor patterns help. Can use base classes and
polymorphism for layer decoupling.
Error handling strategy
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 6
Protocol Design Issues
Addressing
Direction of message/data travel
Presence of logical channels, for example data and
control. Relative priorities.
Error control error detecting and correcting code.
Preservation of message order
Flow control: deal with possibility of under/over-flow.
Message fragmentation; disassemble, send and
reassemble messages that are too large for the
underlying communication medium.
Multiplexing and demultiplexing within a layer
Message routing and forwarding
3
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 7
Layer Services
Connection oriented: before communication may begin a
connection is established between endpoints. Modeled after
telephone service. Generally can expect message order to be
preserved.
connection establishment may require negotiation between endpoints
Connectionless: no connection is established. Generally no
guarantee message order will be preserved.
Quality of service
reliability: generally implemented by receiver acknowledging receipt
of each message
Reliable, connection oriented service
Message stream: message boundaries are preserved
Byte stream: no message boundaries
Reliable, connectionless service:
acknowledges datagram service
Request-reply service
Unreliable, connectionless service
Datagram service
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 8
Reference model and concepts
In general the service interface will vary with the
provided services. Can you think of a minimum set?
Example for a reliable byte stream service
listen
connect
receive
send
disconnect
Three key concepts for each layer:
Services: defines the semantics
Interfaces: how other layers/application access the services.
The layers syntax.
Protocols: How peer layers communication the rules along
with data format and meaning.
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 9
Requirements on framework
asynchronous event notification
directly or indirectly communicate with control
entities
classification and table maintenance
queuing disciplines
message buffering
reside in user-space or kernel-space
if provided, requires bandwidth and delay guarantees
from network/OS
ability to statically or dynamically bind to upper and
lower layers
both global resource management and per
communication channel management
4
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 10
Example layer: Simple Messaging
Message:
src:dst:control
handle_msg(msg)
Simple Message Protocol (SMP)
App1
Connection table
addr0, app0, Mailbox 4, State
addr1, app1, Mailbox 3, State
addr2, app2 Mailbox 5, State
addrN, appN, Mailbox 1, State

App2
AppN

Mailbox0
TxQ RxQ
MailboxN
TxQ RxQ

send(msg) recv(msg)
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 11
Message Passing
Mechanisms used for communication and synchronization
Message Passing
message passing interfaces, mailboxes and message queues
sockets, STREAMS, pipes
Shared Memory: Non-message passing systems
In a Message passing system there are no shared variables. IPC
facility provides two operations for fixed or variable sized message:
send(message)
receive(message)
If processes P and Q wish to communicate, they need to:
establish a communication link
exchange messages via send and receive
Implementation of communication link
physical (e.g., shared memory, hardware bus)
logical (e.g., syntax and semantics, abstractions)
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 12
Implementation Questions
How are links established?
Can a link be associated with more than two processes?
How are links made known to processes?
How many links can there be between every pair/group of communicating
processes?
What is the capacity of a link?
Is the size of a message that the link can accommodate fixed or variable?
Is a link unidirectional or bi-directional?
5
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 13
Message Passing Systems
Exchange messages over a communication link
Methods for implementing a logical
communication link and primitives (send/receive):
1.Direct or Indirect communications (Naming)
2.Symmetric or Asymmetric communications
3.Automatic or Explicit buffering
4.Send-by-copy or send-by-reference
5.fixed or variable sized messages
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 14
Direct Communication Internet and Sockets
Processes must name each other explicitly:
Symmetric Addressing
send (P, message) send to process P
receive(Q, message) receive from Q
Asymmetric Addressing
send (P, message) send to process P
receive(id, message) rx from any; system sets id = sender
Properties of communication link
Links established automatically between pairs
processes must know each others ID
Exactly one link per pair of communicating processes
Disadvantage: a process must know the name or ID of the
process(es) it wishes to communicate with
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 15
Indirect Communication - Pipes
Messages are sent to or received from mailboxes (also
referred to as ports).
Each mailbox has a unique id.
Processes can communicate only if they share a mailbox.
Properties of communication link
Link established only if processes share a common mailbox
A link may be associated with more than 2 processes.
Each pair of processes may share several communication links.
Ownership:
process owns (i.e. mailbox is implemented in user space): only the
owner may receive messages through this mailbox. Other
processes may only send. When process terminates any owned
mailboxes are destroyed.
system owns then mechanisms provided to create, delete, send
and receive through mailboxes. Process that creates mailbox owns
it (and so may receive through it) but may transfer ownership to
another process.
6
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 16
Indirect Communication
Mailbox sharing:
P
1
, P
2
, and P
3
share mailbox A.
P
1
, sends; P
2
and P
3
receive.
Who gets the message?
Solutions
Allow a link to be associated with at most two
processes.
Allow only one process at a time to execute a receive
operation.
Allow the system to select arbitrarily the receiver.
Sender is notified who the receiver was
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 17
Synchronizing Message Flow
Message passing may be either blocking or non-
blocking.
blocking send: sender blocked until message
received by mailbox or process
nonblocking send: sender resumes operation
immediately after sending
blocking receive: receiver blocks until a message is
available
nonblocking receive: receiver returns immediately
with either a valid or null message.
Fred Kuhns (11/9/2004) CS422 Operating Systems Concepts 18
Buffering
All messaging system require framework to
temporarily buffer messages. These queues are
implemented in one of three ways:
1. Zero capacity No messages may be queued within
the link, requires sender to block until receives
retrieves message.
2. Bounded capacity Link has finite number of
message buffers. If no buffers are available then
sender must block until one is freed up.
3. Unbounded capacity Link has unlimited buffer
space, consequently send never needs to block.

Potrebbero piacerti anche