220 likes | 237 Vues
Understand the fundamentals and benefits of layered protocol architecture in network design, covering terminology, advantages, service models, and implementation issues. Learn about encapsulation, interfaces, services, and the OSI reference model. Explore the challenges and strategies in implementing layered protocols.
E N D
CS 5565Network Architecture and Protocols Godmar Back Lecture 4
Announcements • Please read forum regularly • Problem Set 1 posted, due Feb 18 CS 5565 Spring 2009
application transport network link physical Layered Protocol Architecture • What is a layered architecture? • Motivation • Terminology • Reference Models • Implementation Issues • Disadvantages • Alternative Models CS 5565 Spring 2009
Advantages of Layering • Decomposition • Masters complexity • Encapsulation • Hiding of implementation details • Evolution • Layers can change/be replaced • Alternative implementations can be added, possibly coexist • Robustness • Testing layers independently increases confidence CS 5565 Spring 2009
Layer k+1 Layer k Layer k-1 Service Model (vertical component) • Service model • Set/kind of services provided by a layer • Service primitives • Idealized model: • Layer k provides services to layer k+1 using services provided by k-1 CS 5565 Spring 2009
Service Primitives • Service primitives for simple connection-oriented transport service • A layer’s services are accessed via SAP (service access point) – which is entity providing an interface to layer CS 5565 Spring 2009
Service, Interface, and Implementation • Interface: • Set of objects + operations on them, parameters, e.g. object Socket • Operations: listen(), connect(), send(), … • Set of rules governing operations • e.g.: must call connect() before send()/receive() • Encoding & formatting conventions • e.g.: address passed to connect() is 4-byte big endian • May exist in multiple language bindings • Implementation • Code implementing the service CS 5565 Spring 2009
Services vs Protocols (horizontal component) • Layer k may interact with peer layer konly via protocols CS 5565 Spring 2009
Layer k+1 Layer k OSI Layer Terminology CS 5565 Spring 2009
Interfaces vs Protocols • Duality • Both describe rules regarding order and format of “communication” between entities • Difference: • Interface – vertical: between layers • Protocol – horizontal: between peers • NB: Term “protocol” is sometimes used to describe module implementing a layer CS 5565 Spring 2009
OSI Reference Model CS 5565 Spring 2009
Why OSI did not take over • Bad Timing (“apocalypse of the two elephants”) • Bad Technology (Design) • Stemming from vague design goals • Some layers complex/incomprehensible • Duplicate functionality • Bad Implementations • At a time where TCP/IP was already working & wide-spread • Bad Politics • European/US Government imposed • TCP/IP: more community, working prototype based CS 5565 Spring 2009
Bad Timing • David Clark’s opinion: “apocalypse of the two elephants” • States that standards must be developed in the sweet spot after research has matured, but before significant investment CS 5565 Spring 2009
TCP/IP Reference Model CS 5565 Spring 2009
DNS NFS HTTP FTP UDP TCP IP Ethernet ATM Wireless TCP/IP Hourglass View Application Transport Internet Host-To-Network CS 5565 Spring 2009
application: supporting network applications FTP, SMTP, STTP transport:process-process data transfer TCP, UDP network: routing of datagrams host-to-host, from source to destination IP, routing protocols link: data transfer between neighboring network elements PPP, Ethernet physical: bits “on the wire” application transport network link physical Hybrid Reference Model CS 5565 Spring 2009
source network link physical message application transport network link physical segment link physical datagram frame M M Ht Ht M M switch Hn Hn Hn Hn Ht Ht Ht Ht M M M M Hl Hl Hl Hl Hl Hl Hn Hn Hn Hn Hn Hn Ht Ht Ht Ht Ht Ht M M M M M M destination application transport network link physical router Encapsulation CS 5565 Spring 2009
User App user Socket Kernel:“top-half” Kernel:“sw interrupt” TCP Layer IP Layer Kernel:“hw interrupt” Network Device Typical Implementation may cross multiple boundaries! CS 5565 Spring 2009
General Implementation Issues • Who schedules a layer’s processing: • On send: application thread • What if queues are full? Blocking vs. nonblocking • Who does retransmit if necessary? • On receive: interrupt-driven • Not all processing done right away: some delayed processing • Sometimes interrupts can be too slow; polling based approach used instead • Memory management/Protection Issues: • How to you prepend headers? • How do you strip headers? • When are copies needed? • Who allocates and frees packet buffers? CS 5565 Spring 2009
Queuing Layer k+1 send queues recv queues Layer k Layer k-1 CS 5565 Spring 2009
Blocking Send Example Queue q; // layer k send queue // called by layer k+1Send(Payload l) { Packet p = MakePacket(l); SetHeaders(p, …); // … protocol processing … Lock (q) While (Full(q)) WaitOn(q) bool wasEmpty = Empty(q) Enqueue(q, p) if (wasEmpty) StartTransmission() Unlock (q) } // called by layer k-1 TransmissionFinished() { Lock (q) Notify(q) if (not Empty(q)) StartTransmission() Unlock(q) } StartTransmission() { Packet p = Dequeue(q) LowerLayerSend(p) } CS 5565 Spring 2009
Blocking Receive Example Queue rq; // layer k recv queue // called by layer k+1Receive(Buffer b) { Lock (rq) While (Empty(rq)) WaitOn(rq) Packet p = Dequeue (rq) // do protocol processing Copy(Payload(p), b) Free(p) // dispose resources Unlock (rq) } // called by layer k-1 Deliver(Packet p) { Lock (rq) if (not Full(rq)) Enqueue(rq, p) Notify(rq) else Free (p) DroppedPackets++ Unlock(rq) } CS 5565 Spring 2009