Outline: Linux Architecture



Linux Overview



Overall Architecture



Linux Networking



Comparison to Xinu

Xinu Linux
purpose: education free OS
OS: primary goal primary goal
layers: few two/three
upcalls: UPD, ICMP transport
receive: queues, downcalls queues, downcalls
context switches context switches
threads: long-lived long-lived
messages: contiguous contiguous
proj life: decade+ half decade



Comparison to X-kernel

x-kernel Linux
purpose: research free OS
OS: marginal primary goal
layers: many few
upcalls: pervasive two/three
receive: upcalls queues, downcalls
context switches
threads: packet lifetime long-lived
messages: gather-write contiguous
proj life: half-decade half decade



Linux Organization



Linux Organization, continued



UDP/IP/Ethernet packet receive

  1. eexp_irq handles interrupt, calls eexp_hw_rx_pio to find out which buffers contain data, create skbuffers pointing to them, then calls netif_rx to queue the buffer and mark_bh to tell the kernel to execute net_bh
  2. the kernel calls net_bh, which transmits any pending packets, removes packets from the queue, and delivers it to all the upcalls that handle this protocol type
  3. the upcall for IP is ip_rcv, which after sanity checks upcalls the transport-level handler
  4. the UDP upcall is udp_rcv, which finds the appropriate socket structure and calls udp_deliver which queues the packet
  5. UDP receive is done by udp_recvmsg, which calls skb_recv_datagram to blocks if needed. udp_recvmsg then copies the datagram to user space and returns



UDP/IP/Ethernet packet send

  1. udp_sendmsg calls udp_sendto calls udp_send after locking the socket
  2. udp_send fills in the UDP and pseudo headers, and calls ip_build_xmit
  3. ip_build_xmit fills in the IP header, copies the data to an skbuffer, and calls dev_queue_xmit, which enters a critical section in which it calls do_dev_queue_xmit
  4. do_dev_queue_xmit puts a packet into a device queue and starts the hardware (dev->hard_start_xmit(skb, dev))