Download presentation
Presentation is loading. Please wait.
Published byMarcia Cross Modified over 9 years ago
1
ECE 526 – Network Processing Systems Design Software-based Protocol Processing Chapter 7: D. E. Comer
2
Ning WengECE 5262 Goal Understand how the network processing protocol stack ─ Implemented ─ Executed ─ Organized in software based network processing systems.
3
Ning WengECE 5263 Outline Protocol software on conventional processor ─ Possible implementations ─ Processing priority controlling mechanisms Software interrupts Software threads ─ Organization of software for layered systems Summary
4
Ning WengECE 5264 Protocols on Processor High performance network processing systems ─ Protocols with efficient data structures and algorithms ─ Powerful processor ─ Efficient implementation of protocols on processor Three possible implementations ─ In an application program Possible but not practical due lacking of speed ─ In an operating system kernel Software system managing memory and I/O devices Kernel resident in memory all time when processor on Separate address space, highest privilege Containing device driver and controlling device operations ─ In an embedded system Programmable hardware device dedicated for special tasks
5
Ning WengECE 5265 Implementation Comparison Easy of Programming High performance Application domain Application Program EasypoorLess performance demanding OS KernelMost difficultgoodHigher performance and shared by applications EmbeddedPossibly difficult goodStand-alone device: bridge
6
Data movement within protocols Ning WengECE 5266
7
Ning WengECE 5267 Interrupts What is interrupt? ─ Event signal to OS which results in context switch Interrupt mechanism ─ Operating asynchronously ─ Saving current processing state ─ Changing processor status ─ Branches to specified locations Types of interrupt ─ Hardware interrupt: raised by device ─ Software interrupt: raised by executing program Protocol stack operating as software interrupt ─ When packet arrives, hardware interrupts ─ Device drive raises software interrupt ─ Interrupts cleared and protocol processing invoked Multiple interrupts, how to determine who gets service first ─ Priority
8
Ning WengECE 5268 Priorities Determining the code which CPU executing at any time Interrupts have different priorities Higher priority code can interrupt lower priority code Kernel software can specify desired interrupt level Possible outcome of priorities processing ─ Livelock: CPU has no efficient power to handle a higher priority load Packet processing: ─ Device (NIC): receiving packets ─ Protocol stack: processing packets ─ Applications: further processing packet if necessary ─ Question: who should has the highest priority
9
Ning WengECE 5269 Packet Processing Priority Packet processing priorities: ─ Highest to device driver ─ Lowest to application Requires queues between interrupt levels ─ Why? ─ What is inside queues? Processing in higher interrupts should be kept briefly
10
Ning WengECE 52610 Kernel Threads Thread: piece of software that runs in its own context ─ Similar to process but is light-weight Different threads can run in different priorities ─ More fine-grained than interrupt levels ─ Scheduling policy allocating CPU to threads Thread synchronization handles access to shared data ─ Multiple exclusion: only one thread has accesses to data structure ─ Notification: thread blocks until event occurs How should threads be assigned to layered protocol? ─ One thread per layer ─ One thread per protocol ─ Multiple threads per protocol ─ One thread per packet
11
Ning WengECE 52611 Timer Management Fundamental function Timers used for ─ Protocols ARP for retransmission and cache management IP for re-assembly TCP for retransmission ─ Scheduling Multiple independent timers required ─ Cost can be high
12
Ning WengECE 52612 One Thread per Layer Different layers have different thread Allowing priority to be assigned to each layer A packet is en-queued once per layer Easy for programmer to understand
13
Ning WengECE 52613 One Thread per Protocol Each protocol has its own thread and queue Advantage over one thread per layer ─ Easier for programmer to understand ─ Finer-grain control and each protocol has its own priority
14
Ning WengECE 52614 Multiple Threads per Protocol Further division of duties Finer-granularity control and easier for programming Example division ─ One thread for incoming packets ─ One thread for outgoing packets ─ Thread for management/timing
15
Ning WengECE 52615 One Thread per Packet Layers introducing overhead ─ Queuing ─ Context switching ─ Requiring many threads How about packet processed entirely by one thread? ─ “run to completion” programming mode One thread operation ─ Pre-allocating set of operations ─ Waiting for packet arrive ─ Moving through protocol stack ─ Returning to wait for next packet
16
Ning WengECE 52616 Asynchronous vs. Synchronous Synchronous programming: thread-structured ─ API using blocking Main flow-of-control Explicitly invokes functions as needed ─ API using polling Function call returns immediately Performs operations if available Returns error code otherwise Asynchronous programming: event-driven ─ Programmer specifying which function to invoke for each event type ─ Programmer has no control over function invocation ─ Difficult to program
17
Ning WengECE 52617 Typical Implementations Application program ─ Synchronous API using blocking (e.g. socket API) ─ One application thread running while other blocks Embedded system ─ Synchronous API using polling ─ CPU dedicating to one task Operating systems ─ Asynchronous API ─ Built on interrupt mechanism
18
Ning WengECE 52618 Summary Protocol processing implementation on conventional processor ─ Application ─ OS kernel ─ Embedded systems Packet processing priorities Two mechanism to control processing priorities ─ Software interrupt ─ Kernel thread abstraction
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.