Accompanying slides for Project 3
Download
Report
Transcript Accompanying slides for Project 3
CS415
Minithreads Project 3
Overview
Adrian Bozdog (Adi)
[email protected]
What you have to do
Implement unreliable communication
Simulate IP/UDP protocol
No UDP check-sum
No UDP fragmentation
There is an IP layer that sends and receives
messages (see network.c)
Start using Jornada systems
Run Project 3 on both PC desktops and
Jornada systems
CS414 Minithreads overview
2
Networking pseudo-device
(1)
It allows communication between minithreads
systems
Does not control which thread processes a
received packet
Interrupt-driven implementation
Network_handler
executed for each received packet
Uses the stack of the current thread
It should finish as soon as possible
Initialized using network_initialize function
CS414 Minithreads overview
3
Networking pseudo-device
(2)
Network_handler receives a structure:
typedef struct {
network_address_t addr; - sender
char buffer[MAX_NETWORK_PKT_SIZE]; - the body of
entire message
int size; - the length of the entire message
} network_interrupt_arg_t;
Call Network_initialize function
After clock_initialize()
Before enabling interrupts and running threads
CS414 Minithreads overview
4
Networking functions
Network_send_pkt – sends a packet
Destination
Header (body, length)
Data (body,length)
Header:
Extra information
About the sender
About the receiver
As small as possible
CS414 Minithreads overview
5
Minimsg Layer
Identifies the end-points of the
communication (ports)
The sender assembles the header used to
identifies the endpoints
The receiver
examines the header
Identifies destination
Enqueues the packet in the right place
CS414 Minithreads overview
6
Minimsg Functions
Minimsg_send:
Non-blocking
Parameters:
local and remote ports
The message and its length
Appends the header to the message
Sends the entire data using network_send
Minimsg_receive:
Blocks the thread until it receives a message on
the specified port
Receives information about the remote port –
used to reply
CS414 Minithreads overview
7
Miniports
Data structures that represents endpoints
Local ports:
Usually, used for listening
Remote ports:
Created when a packet is received
Bound to a sending “remote” port
Allows the receiver to reply
CS414 Minithreads overview
8
Miniports Example
Ports 2,3 – local ports
A,B - Threads
Sender A sends a message to Receiver B
2
A
Sender
CS414 Minithreads overview
3
B
Receiver
9
Miniports Example
Creates the remote port 100
B receives the message;
Minithreads system creates the remote
port 100
2
A
Sender
CS414 Minithreads overview
3
100
B
Receiver
10
Miniports Example
B replies to A
B uses the remote port as the destination of
the message; the message is relayed to the
sending port
2
A
Sender
CS414 Minithreads overview
3
100
B
Receiver
11
Miniports – hints
Local communication
Be aware of miniport_destroy function called by
the receiver
Remote_miniport – pointer to the local port
Miniport_send implemented based on the “remote
port”
Miniports
Identified by numbers
Assigned them successive numbers
Local miniports – starts from 0
Remote miniports – starts from 32768
CS414 Minithreads overview
12
Implementation hints
Do not add unnecessary data to the header
(ex: header length)
Include the address of the sender (used by the
routing protocol later)
Port operations must be O(1)
Do not waste resources
Remote miniports are destroyed by the
application
Build other test cases
Network_initialize returns the ip address of
the machine
Due Date: March 3, 12 pm
CS414 Minithreads overview
13
Jornada systems
Every group must have at least a
Jornada system
Come to my office (Upson 5152)
I’ll post an announcement
You must fill check-out forms
Information for using Jornada in the
assignment description
CS414 Minithreads overview
14