Outline: Xinu architecture
Xinu Overview
- simple operating system
- Xinu Is Not Unix:
- publicly available source code (in the '80s)
- threads, not processes
- multi-threaded OS, including IPC primitives
- different system calls
- simpler, less powerful
- optimized for speed, small size
- educational focus: everything well documented, explained, clear
- simplest method to get the job done
- Comer at Purdue
Xinu Networking
- Full TCP/IP stack, including:
- Ethernet
- ARP, RARP
- IP, ICMP, IP multicast and IGMP
- RIP, OSPF
- TCP, UDP
- SNMP
- multithreaded implementation
- layered implementation
TCP/IP layers
- device layer (ethernet driver)
- IP layer (including ICMP and most UDP processing)
- TCP layer
- application layer
Data Flow
- Comer+Stevens book, Figure 2.6 (page 23)
- Comer+Stevens book, Figure 2.7 (page 24)
Network Interface
- struct netif
- name
- state: up, down, testing
- IP, network number, subnetwork number, mask, broadcast address
- MTU
- ARP hardware type, hardware address length, hardware address, hardware
broadcast address
- device descriptor
- IP input queue
- device output queue
- statistics
IP thread
- basic algorithm: loop forever
- read a packet
- do input processing (checksum checking if needed)
- route (or discard) the packet
- forward the packet on the correct interface.
- why this works:
- local interface to upper levels
- queues are used on each interface
- if there are no packets, IP sleeps
- any function that adds a packet to a queue wakes up IP (no-op if
IP is awake)
- fairness: IP reads the queues in round-robin order
ICMP, UDP
- ICMP is part of IP
- icmpin called by netwrite, handles incoming
ICMP packets
- ipproc calls icmp to send ICMP messages
such as destination unreachable,
time exceeded, or redirect
- udpin is also called directly by netwrite,
runs as part of the IP thread
- udpsend calls ipsend which enqueues the
packet on the local network interface and wakes up the IP thread
TCP input thread
- Input thread, tcpinp, loops forever:
- read packets from the TCP input queue
- checksum the TCP packet
- find a TCB
- process TCP options, if any
- call a TCB-state-dependent procedure:
tcpswitch[ptcb->tcbstate] (ptcb, pep);
TCP output thread
- output thread
- output state machine has 4 states:
- idle
- transmit
- retransmit
- persist (wait for window to become non-zero)
- output state machine handles 4 messages:
- send this packet
- persist (send probe packet)
- retransmit queued packet
- delete a TCB
tcpout loops forever
TCP timer thread
- delta list:
- events are stored in a list in order of increasing deadline
- delay for each event is from expiration of previous event
- only the first element of the list ever needs to be checked -- O(1)
- insertion of a new event may traverse entire list -- O(n)
- timer thread tcptimer loops forever:
- sleep 0.1s
- if delta list is empty, suspend
- for each expired event (since last time we executed),
send a message to a Xinu port
(usually to TCP output thread)