You are on page 1of 14

Protocol Implementation

An Engineering Approach to Computer Networking

Protocol implementation
I I

Depends on structure and environment Structure N partitioning of functionality between user and kernel N separation of layer processing (interface) Environment N data copy cost N interrupt overhead N context switch time N latency in accessing memory N cache effects

Partitioning strategies
I

I I I

How much to put in user space, and how much in kernel space? N tradeoff between ! software engineering ! customizability ! security ! performance Monolithic in kernel space Monolithic in user space Per-process in user space

Interface strategies
I I I

Single-context Tasks Upcalls

Monolithic in kernel

Monolithic in user space

Per-process in user space

Interfaces
I I I

Single-context Tasks Upcalls

Single context

Tasks

Upcalls

Protocol implementation

Some numbers
I I I I I I I I

10 Kbps 400 ms 100 Kbps, 40 ms 1 Mbps, 4 ms 100 Mbps, 40 s User-to-kernel context switch Copying the packet Checksum in software Scheduling delays workload) Interrupt handling bus) Protocol processing protocol complexity)

~40 s ~25 s ~40 s ~150 s (depends on ~10-50 s (depends on the ~15 -100 s (depends on

Rules of thumb
I I I I I I I I I I

Optimize common case Watch out for bottlenecks Fine tune inner loops Choose good data structures Beware of data touching Minimize # packets sent Send largest packets possible Cache hints Use hardware Exploit application properties

You might also like