660 likes | 888 Views
Distributed Embedded Systems. Class Goals. At the conclusion of this class, the student should be able to: Understand differences between co-processors and accelerators Understand how to interface an accelerator to a CPU Compare accelerated single-threaded and multi-threaded applications.
E N D
Class Goals • At the conclusion of this class, the student should be able to: • Understand differences between co-processors and accelerators • Understand how to interface an accelerator to a CPU • Compare accelerated single-threaded and multi-threaded applications Csci-339/HFU, Spring 2007
Topic Outline • Networking Embedded Systems • Networking Fundamentals • The I2C Bus • Ethernet • Internet Protocol (IP) Networks • Analyses of Networks • Summary Csci-339/HFU, Spring 2007
ES ES ES ES ES Network Elements Each embedded system (ES) may communicate with any other ES in the network. Csci-339/HFU, Spring 2007
initial processing more processing Networks in embedded systems PE sensor PE PE actuator Csci-339/HFU, Spring 2007
Why distributed? • Resource constrained platforms cannot perform the entire application • Automated application updates • Functionality is widely varied among a set of embedded platforms • Timing constraints • Centralized control of resources may increase network traffic loading Csci-339/HFU, Spring 2007
Recipes Orders … App Server Mix Dough Measure Cook Time PE1 PE3 PE4 Network Measure Muffin Throughput Measure Temp PE2 Adjust Temp PE5 Embedded System in a Bakery Csci-339/HFU, Spring 2007
The OSI Seven Layer Model • International Standards Organization (ISO) developed the Open Systems Interconnection (OSI) model to describe networks: • Provides a standard way to classify network components and operations. Csci-339/HFU, Spring 2007
application end-use interface presentation data format session application dialog control transport connections network end-to-end service data link reliable data transport physical mechanical, electrical OSI model Csci-339/HFU, Spring 2007
Network protocols. Files Files HTTP TCP IP packets packets packets packets packets packets Links Sources Csci-339/HFU, Spring 2007
Distributed Network Architectures • Many different types of networks: • topology; • scheduling of communication; • routing. Csci-339/HFU, Spring 2007
Point-to-point networks • One source, one or more destinations, no data switching (serial port): PE 3 PE 1 PE 2 link 1 link 2 Csci-339/HFU, Spring 2007
Bus networks • Common physical connection: PE 1 PE 2 PE 3 PE 4 packet format header address data ECC EOT Csci-339/HFU, Spring 2007
Bus arbitration • Fixed: Same order of resolution every time. • Fair: every PE has same access over long periods. • round-robin: rotate top priority among Pes. fixed A B C A B C round-robin A B C B C A t A,B,C A,B,C Csci-339/HFU, Spring 2007
Message-based programming • Transport layer provides message-based programming interface: send_msg(adrs,data1); • Data must be broken into packets at source, reassembled at destination. • Data-push programming: make things happen in network based on data transfers. Csci-339/HFU, Spring 2007
I2C Bus • Serial communications bus • 0 - 400 Kbps operation (100 Kbps typical) • SDA – Serial DAta Line • SCL – Serial CLock Line • Loosely-defined electrical specification • Low implementation cost Csci-339/HFU, Spring 2007
I2C bus • Characteristics: • Supports multiple bus masters • fixed-priority arbitration. • Several microcontrollers come with built-in I2C controllers • Each I2C device is given a unique bus address Csci-339/HFU, Spring 2007
I2C physical layer master A master B SDA SCL slave 1 slave 2 Csci-339/HFU, Spring 2007
I2C data format u /V t/s u /V t/s LSB MSB Csci-339/HFU, Spring 2007
I2C electrical interface + • Open collector interface: SDA + SCL Csci-339/HFU, Spring 2007
I2C signaling • Sender pulls down bus for 0. • Sender listens to bus---if it tried to send a 1 and heard a 0, someone else is simultaneously transmitting. • Transmissions occur in 8-bit bytes. Csci-339/HFU, Spring 2007
I2C data link layer • Every device has an address (7 bits in standard, 10 bits in extension) • LSB of address signals read or write • General call address allows broadcast • Address 00000000 is the indicator for a “general call” or broadcast Csci-339/HFU, Spring 2007
I2C bus arbitration • Sender listens while sending address. • When sender hears a conflict, if its address is higher, it stops signaling. • Low-priority senders relinquish control early enough in clock cycle to allow bit to be transmitted reliably. Csci-339/HFU, Spring 2007
I2C transmissions Start Write (LSB of address) Stop (multi-) byte write S Adrs 0 Word-adr Data P Csci-339/HFU, Spring 2007
I2C transmissions Start Stop Read (LSB of address) Write (LSB of address) Write addreses, then read S Adrs 0 Word-adr S Adrs 1 Data P Csci-339/HFU, Spring 2007
Ethernet • Dominant LAN technology • Typical: 10/100 Mb/s and 1 Gb/s • Future: 10 Gbps and 40 Gbps • Goal: reliable communication over an unreliable medium. Csci-339/HFU, Spring 2007
Ethernet topology • Bus-based system, several possible physical layers: A B C Csci-339/HFU, Spring 2007
CSMA/CD • Carrier sense multiple access with collision detection: • sense collisions; • exponentially back off in time; • retransmit. Csci-339/HFU, Spring 2007
Ethernet packet format preamble start frame source adrs dest adrs length data payload padding CRC Csci-339/HFU, Spring 2007
Ethernet performance • Quality-of-service tends to non-linearly decrease at high load levels. • Can’t guarantee real-time deadlines. However, may provide very good service at proper load levels. Csci-339/HFU, Spring 2007
Internet Protocol • Internet Protocol (IP) is basis for Internet. • Provides an internetworking standard: between two Ethernets, Ethernet and token ring, etc. • Higher-level services are built on top of IP. Csci-339/HFU, Spring 2007
IP in communication application application presentation presentation session session IP transport transport network network network data link data link data link physical physical physical router node A node B Csci-339/HFU, Spring 2007
IP packet • Includes: • version, service type, length • time to live, protocol • source and destination address • data payload • Maximum data payload is 65,535 bytes. Csci-339/HFU, Spring 2007
IP addresses • 32 bits in early IP, 128 bits in IPv6. • Typically written in form xxx.xx.xx.xx. • Names (foo.baz.com) translated to IP address by domain name server (DNS). Csci-339/HFU, Spring 2007
Internet routing • Best effort routing: • doesn’t guarantee data delivery at IP layer. • Routing can vary: • session to session; • packet to packet. Csci-339/HFU, Spring 2007
Higher-level Internet services • Transmission Control Protocol (TCP) provides connection-oriented service. • Quality-of-service (QoS) guaranteed services are under development. Csci-339/HFU, Spring 2007
The Internet service stack FTP HTTP SMTP telnet SNMP User Datagram Protocol TCP UDP IP Csci-339/HFU, Spring 2007
Networks • Network-based design. • Communication analysis. • System performance analysis. • Internet-enabled systems. Csci-339/HFU, Spring 2007
Communication analysis • First, understand delay for single message. • Delay for multiple messages depends on: • network protocol; • devices on network. Csci-339/HFU, Spring 2007
Message delay • Assume: • single message; • no contention. • Delay: • tm = tx + tn + tr • = xmtr overhead + network xmit time + rcvr overhead Csci-339/HFU, Spring 2007
Example: I2C message delay • Network transmission time dominates. • Assume 100 kbits/sec, one 8-bit byte. • Number of bits in packet: • npacket = start + address + data + stop • = 1 + 8 + 8 + 1 = 18 bits • Time required to transmit: 1.8 x 10-4 sec. • 20 instructions on 8 MHz controller adds 2.5 x 10-6 delay on xmtr, rcvr. Csci-339/HFU, Spring 2007
Multiple messages • If messages can interfere with each other, analysis is more complex. • Model total message delay: • ty = td + tm • = wait time for network + message delay Csci-339/HFU, Spring 2007
Arbitration and delay • Fixed-priority arbitration introduces unbounded delay for all but highest-priority device. • Unless higher-priority devices are known to have limited rates that allow lower devices to transmit. • Round-robin arbitration introduces bounded delay proportional to N. Csci-339/HFU, Spring 2007
Task graph: Network: execution time 3 3 allocation 4 Transmission time = 4 Example: adjusting messages to reduce delay P1 P2 M1 M2 M3 d1 d2 P3 Csci-339/HFU, Spring 2007