TTK4145 - Sanntidsprogrammering


We need to distribute a system, networking is the solution.

  • Reliable software from unreliable parts

Sockets UDP (User Datagram Protocol) TCP (Transmission Control Protocol)


1. Fault Tolerance

  • Anything can fail
  • A system must keep working
  • And we must consider that
    • Messages will be lost
    • 2. Distribution
  • Less likely that the entire system fails
  • How do we make the distribution “additive”?
    • Sparseness, aka we do not want to rely on one part of the system.
  • 2.a. Physical distribution
    • The same/similar program running twice on the same machine
    • We need to send copies of local data to achieve this 3. Persistence
  • We need a concept of time to decide mismatch between data
  • Messages can come in any order (due to restarting nodes etc)
    • Therefore we can receive replies to messages we have not sent yet. 4. Bug repellence
  • Handle any messages in any order

Networks from scratch

How to connect any two programs or any two machines efficiently


  1. Physical Layer
    • Ethernet, CAN, USB, Bluetooth etc
  2. Link Layer
    • Differentiate between several physical connections
    • MAC addresses (globally unique)
  3. Network Layer
    • Create a routing algorithm if we have a hierarchical system
      • Naive solution
      • In reality we have a local address, which tries to go to a remote address via a defau
  4. Transport Layer