DOC PREVIEW
CORNELL CS 4410 - Unreliable Datagrams

This preview shows page 1-2-20-21 out of 21 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Project ScopeImplementation detailsUsing the networking pseudo-deviceInterruptsMiniportsConcluding Thoughts (Grading)Project 3Project 3Unreliable DatagramsRobert EscrivaSlide heritage: Previous TAs → Krzysztof OstrowskiCornell CS 4411, September 27, 2010Project 3AnnouncementsProject 2 due Wednesday at 11:59PM.Project 1 will be returned (with feedback) before then.Web page is being updated frequently; check forupdates.Email [email protected] help.Project 3The real hero of programming is the one whowrites negative code.Douglas McIlroy, Cornell ’54Project 31 Project Scope2 Implementation detailsUsing the networking pseudo-deviceInterruptsMiniportsAn Example3 Concluding Thoughts (Grading)Project 3Project ScopeWhat are do unreliable datagrams involve?Simulate (parts of) UDP/IPBuild a datagram networking stack.Use the pseudo-network interface network.h for“IP”.Using ports to identify endpoints.A minimessage layer for thread I/O.Project 3Project ScopeThe Interfacevoid minimsg_initialize();miniport_t miniport_local_create();miniport_t miniport_remote_create(network_address_t addr, int id);void miniport_destroy(miniport_t miniport);int minimsg_send(miniport_t local,miniport_t remote,minimsg_t msg, int len);int minimsg_receive(miniport_t local,miniport_t*remote,minimsg_t msg, int*len);Project 3Implementation detailsUsing the networking pseudo-deviceOverviewThe networking device should be treated as the IP layer ofyour system.It transparently enables communication between othersystems running minithreads.network5.cnetwork6.cProject 3Implementation detailsInterruptsNetworking is interrupt-drivennetwork_initialize() installs the handler.Should be initialized after clock_initialize andbefore interrupts.The prototype/behavior is similar to the clockinterrupt.Each packet triggers an interrupt.Interrupts are delivered on the current thread’s stack.This should finish as soon as possible!Project 3Implementation detailsInterruptsnetwork_handlertypedef struct {// sendernetwork_address_t addr;// hdr+datachar buffer[MAX_NETWORK_PKT_SIZE];// sizeint size;} network_interrupt_arg_t;The header and the data are joined in the buffer; youmust strip it off.Project 3Implementation detailsInterruptsNetworking Functionsint network_send_pkt(network_address_t dest_address,int hdr_len, char*hdr,int data_len, char*data);Header contains information about the sender andreceiver.As small as possibleProject 3Implementation detailsMiniportsOverviewA miniport is a datastructure that represents an endpoint.Local ports are unbound ports; they may be used forlistening and can receive from any remote port.Remote ports are bound ports; they make repliespossible.Project 3Implementation detailsMiniportsA sends from port 1 to port 3Local Ports: 1, 3Remote Ports: 2Threads: A, BSenderReceiverA B213Project 3Implementation detailsMiniportsMinithreads creates port 100 and delivers messageThe port 100 is created in order to allow B to respond.The message is delivered to local 3.B is unblocked.SenderReceiverA B213100Project 3Implementation detailsMiniportsB responds to A over the new remote port.B received a reference to port 100.B can send to 100.The message will be sent to 1 (A).SenderReceiverA B213100Project 3Implementation detailsMiniportsWhat does the datastructure look like?Conceptually it looks like this∗:struct miniport {char port type;int port number;queue_t data;semaphore_t lock;semaphore_t ready;network_address_t remote_addr;int remote_port;int remote_is_local;}∗the next slide should be referenced when implementingProject 3Implementation detailsMiniportsYou should use unionsUnions store two overlapping datastructures†.union {struct {queue_t data;semaphore_t lock;semaphore_t ready;} loc;struct {network_address_t addr;int portno;} rem;} u;†You should use this to replace the last 6 variables from the struct on theprevious pageProject 3Implementation detailsMiniportsImplementation hints - Local communicationminiport_destroy will be called by the receiver.miniport_send sends data to the “remote port”.Remote ports can refer to a local port.Project 3Implementation detailsMiniportsImplementation hints - MiniportsIdentified by a 16-bit unsigned number (the actualdatatype is bigger).Assign successive numbers (even if the port closes).Local miniports are 0-32767.Remote miniports are 32768-65535.Project 3Implementation detailsMiniportsMinimsg LayerThe sender assembles a header that identifies theend points of communication.The receiver parses the header to identify thedestination, enqueue the packet, and wake up anysleeping threads.Project 3Implementation detailsMiniportsMinimsg Functionsint minimsg_send(miniport_t local,miniport_t remote,minimsg_t msg, int len);Non-blocking (i.e. doesn’t wait for the send tosucceed).Sends data using network_send_pkt().int minimsg_receive(miniport_t local,miniport_t*remote,minimsg_t msg, int*len);Blocks until a message is received.Provides remote port so a reply may be sent.Project 3Concluding Thoughts (Grading)GradingInclude the address of the sender in the header (usedin Project 5).Port operations must be O(1).Do not waste resources.Make sure to not reassign ports that are in-use.The application destroys remote miniports.We will be grading you on your implementation andtest


View Full Document

CORNELL CS 4410 - Unreliable Datagrams

Download Unreliable Datagrams
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Unreliable Datagrams and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Unreliable Datagrams 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?