Chapter 7 Protocol Software On A Conventional Processor.

Slides:



Advertisements
Similar presentations
Processes Management.
Advertisements

ECE 526 – Network Processing Systems Design Software-based Protocol Processing Chapter 7: D. E. Comer.
04/14/2008CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
Thursday, June 08, 2006 The number of UNIX installations has grown to 10, with more expected. The UNIX Programmer's Manual, 2nd Edition, June, 1972.
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
1 CS 333 Introduction to Operating Systems Class 2 – OS-Related Hardware & Software The Process Concept Jonathan Walpole Computer Science Portland State.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
04/16/2010CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying an earlier edition.
3.5 Interprocess Communication
I/O Systems CS 3100 I/O Hardware1. I/O Hardware Incredible variety of I/O devices Common concepts ◦Port ◦Bus (daisy chain or shared direct access) ◦Controller.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Process Concept An operating system executes a variety of programs
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
3/11/2002CSE Input/Output Input/Output Control Datapath Memory Processor Input Output Memory Input Output Network Control Datapath Processor.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
LWIP TCP/IP Stack 김백규.
Hardware Definitions –Port: Point of connection –Bus: Interface Daisy Chain (A=>B=>…=>X) Shared Direct Device Access –Controller: Device Electronics –Registers:
I/O Systems I/O Hardware Application I/O Interface
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
1 Chapter 2: Computer-System Structures  Computer System Operation  I/O Structure  Storage Structure  Storage Hierarchy  Hardware Protection  General.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
CE Operating Systems Lecture 11 Windows – Object manager and process management.
Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection Network Structure.
Chapter 13: I/O Systems. 13.2/34 Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware.
Scheduling Lecture 6. What is Scheduling? An O/S often has many pending tasks. –Threads, async callbacks, device input. The order may matter. –Policy,
OS2014 PROJECT 2 Supplemental Information. Outline Sequence Diagram of Project 2 Kernel Modules Kernel Sockets Work Queues Synchronization.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
1 Client-Server Interaction. 2 Functionality Transport layer and layers below –Basic communication –Reliability Application layer –Abstractions Files.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
Silberschatz, Galvin and Gagne  Applied Operating System Concepts Chapter 2: Computer-System Structures Computer System Architecture and Operation.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 13: I/O Systems Overview I/O Hardware Application.
Processes. Process Concept Process Scheduling Operations on Processes Interprocess Communication Communication in Client-Server Systems.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O.
Major OS Components CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Introduction to Operating Systems Concepts
Chapter 13: I/O Systems.
Module 12: I/O Systems I/O hardware Application I/O Interface
Processes and threads.
LWIP TCP/IP Stack 김백규.
OPERATING SYSTEMS CS3502 Fall 2017
Chapter 2 Processes and Threads Today 2.1 Processes 2.2 Threads
CSCI 315 Operating Systems Design
Module 2: Computer-System Structures
I/O Systems I/O Hardware Application I/O Interface
Operating System Concepts
13: I/O Systems I/O hardwared Application I/O Interface
CS703 - Advanced Operating Systems
Mid Term review CSC345.
Module 2: Computer-System Structures
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Module 12: I/O Systems I/O hardwared Application I/O Interface
Presentation transcript:

Chapter 7 Protocol Software On A Conventional Processor

Outline Possible Implementations Of Protocol Software Interface To The Network Asynchronous API Synchronous API Using Blocking Synchronous API Using Polling Typical Implementations And APIs Processing Priorities Interrupt Mechanism Kernel Threads Conceptual Organization Timers And Protocols Context Switch

Possible Implementations Of Protocol Software (1/3) In an application program – Easy to program – Runs as user-level process – No direct access to network devices – High cost to copy data from kernel address space – Cannot run at wire speed

Possible Implementations Of Protocol Software (2/3) In an embedded system – Special-purpose hardware device – Dedicated to specific task – Ideal for stand-alone system – Software has full control

Possible Implementations Of Protocol Software (3/3) In an operating system kernel More difficult to program than application Runs with kernel privilege Direct access to network devices

Interface To The Network Known as Application Program Interface (API) Can be – Asynchronous – Synchronous Synchronous interface can use – Blocking – Polling

Asynchronous API Also known as event-driven Programmer – Writes set of functions – Specifies which function to invoke for each event type Programmer has no control over function invocation Functions keep state in shared memory Difficult to program Example: function f() called when packet arrives

Synchronous API Using Blocking Programmer – Writes main flow-of-control – Explicitly invokes functions as needed – Built-in functions block until request satisfied Example: function wait_for_packet() blocks until packet arrives Easier to program

Synchronous API Using Polling Nonblocking form of synchronous API Each function call returns immediately – Performs operation if available – Returns error code otherwise Example: function try_for_packet() either returns next packet or error code if no packet has arrived Closer to underlying hardware

Typical Implementations And APIs Application program – Synchronous API using blocking (e.g., socket API) – Another application thread runs while an application blocks Embedded systems – Synchronous API using polling – CPU dedicated to one task Operating systems – Asynchronous API – Built on interrupt mechanism

Example Asynchronous API (1/3) Design goals – For use with network processor – Simplest possible interface – Sufficient for basic packet processing tasks Includes – I/O functions – Timer manipulation functions

Example Asynchronous API (2/3) Initialization and termination functions – on_startup() – on_shutdown() Input function (called asynchronously) – recv_frame() Output functions – new_fbuf() – send_frame()

Example Asynchronous API (3/3) Timer functions (called asynchronously) – delayed_call() – periodic_call() – cancel_call() Invoked by outside application – console_command()

Processing Priorities Determine which code CPU runs at any time General idea – Hardware devices need highest priority – Protocol software has medium priority – Application programs have lowest priority Queues provide buffering across priorities

Illustration Of Priorities

Implementation Of Priorities In An Operating System Two possible approaches – Interrupt mechanism – Kernel threads

Interrupt Mechanism Built into hardware Operates asynchronously Saves current processing state Changes processor status Branches to specified location

Two Types Of Interrupts Hardware interrupt – Caused by device (bus) – Must be serviced quickly Software interrupt – Caused by executing program – Lower priority than hardware interrupt – Higher priority than other OS code

Software Interrupts And Protocol Code Protocol stack operates as software interrupt When packet arrives – Hardware interrupts – Device driver raises software interrupt When device driver finishes – Hardware interrupt clears – Protocol code is invoked

Kernel Threads Alternative to interrupts Familiar to programmer Finer-grain control than software interrupts Can be assigned arbitrary range of priorities

Conceptual Organization Packet passes among multiple threads of control Queue of packets between each pair of threads Threads synchronize to access queues

Possible Organization Of Kernel Threads For Layered Protocols One thread per layer One thread per protocol Multiple threads per protocol Multiple threads per protocol plus timer management thread(s) One thread per packet

One Thread Per Layer Easy for programmer to understand Implementation matches concept Allows priority to be assigned to each layer Means packet is enqueued once per layer

Illustration Of One Thread Per Layer

One Thread Per Protocol Like one thread per layer – Implementation matches concept – Means packet is enqueued once per layer Advantages over one thread per layer – Easier for programmer to understand – Finer-grain control – Allows priority to be assigned to each protocol

Illustration Of One Thread Per Protocol TCP and UDP reside at same layer Separation allows priority

Multiple Threads Per Protocol Further division of duties Simplifies programming More control than single thread Typical division – Thread for incoming packets – Thread for outgoing packets – Thread for management/timing

Illustration Of Multiple Threads Used With TCP Separate timer makes programming easier

Timers And Protocols Many protocols implement timeouts TCP – Retransmission timeout – 2MSL timeout ARP – Cache entry timeout IP – Reassembly timeout

Multiple Threads Per Protocol Plus Timer Management Thread(s) Observations – Many protocols each need timer functionality – Each timer thread incurs overhead Solution: consolidate timers for multiple protocols

Is One Timer Thread Sufficient? In theory – Yes In practice – Large range of timeouts (microseconds to tens of seconds) – May want to give priority to some timeouts Solution: two or more timer threads

Multiple Timer Threads Two threads usually suffice Large-granularity timer – Values specified in seconds – Operates at lower priority Small-granularity timer – Values specified in microseconds – Operates at higher priority

Thread Synchronization Thread for layer i – Needs to pass a packet to layer i+ 1 – Enqueues the packet Thread for layer i+ 1 – Retrieves packet from the queue

Thread Synchronization Thread for layer i – Needs to pass a packet to layer i+ 1 – Enqueues the packet Thread for layer i+ 1 – Retrieves packet from the queue

Context Switch OS function CPU passes from current thread to a waiting thread High cost Must be minimized

One Thread Per Packet Preallocate set of threads Thread operation – Waits for packet to arrive – Moves through protocol stack – Returns to wait for next packet Minimizes context switches

QUESTION ?