l4 darwin evolving unix
play

L4/Darwin: Evolving UNIX Charles Gray Research Engineer, National - PowerPoint PPT Presentation

L4/Darwin: Evolving UNIX Charles Gray Research Engineer, National ICT Australia charles.gray@nicta.com.au Outline 1. Project Overview 2. BSD on the Mach microkernel 3. Porting Darwin to the L4 microkernel 4. Project Status 2 Darbat


  1. L4/Darwin: Evolving UNIX Charles Gray Research Engineer, National ICT Australia charles.gray@nicta.com.au

  2. Outline 1. Project Overview 2. BSD on the Mach microkernel 3. Porting Darwin to the L4 microkernel 4. Project Status 2

  3. Darbat Overview • Para-virtualised Darwin kernel • L4 μ -kernel hypervisor • Isolated kernel and device drivers • Standard virtualisation benefits 3

  4. Why? • Virtualisation • Flexibility • Robustness • Code size 4

  5. Linux Kernel Size (LoC) 7,000,000 6,000,000 5,000,000 4,000,000 3,000,000 2,000,000 1,000,000 0 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 5

  6. Mach • Once a hot research topic Application Application • Many attempts at BSD Process Mgr Disk on Mach File System Network • Darwin is a monolithic User Mach kernel Kernel Mach • Gave microkernels a Hardware bad name 6

  7. What’s in a kernel? • XML parser • Decompression algorithms • Linker • Network routing • Device drivers • Strings 7

  8. Mac OS X Architecture OS X App Darwin launchd UNIX App Aqua GUI User Kernel xnu Hardware 8

  9. Darwin • Unique kernel design UNIX App OS X App ‣ Mach 3.0 μ -kernel User ‣ 4.4 BSD derivative Kernel ‣ I/O Kit device drivers BSD • Mac OS X applications • Full FreeBSD 5 UNIX Mach I/O Kit environment Hardware 9

  10. BSD Layer listen() User fork() mmap() Kernel BSD HFS+ TCP UFS Threads Process UBC Scheduler Disk Network VM PCI Bus Mach I/O Kit interrupt 10

  11. The I/O Kit User mach_msg() Kernel BSD HFS+ User Partition0 Partition1 Client paging Disk0 Disk1 Keyboard ATA NIC UHCI interrupt PCI Bus Mach I/O Kit 11

  12. BSD and I/O Kit read() ioctl() User Kernel BSD HFS+ bdevsw Partition0 Partition1 Disk0 Disk1 SCSI ATA I/O Kit 12

  13. L4 • 2nd generation u-kernel • Learn from mistakes of Mach • Pay attention to cache, TLB, complexity • Make microkernels work • 10-20x performance improvement over Mach 13

  14. L4 μ -kernel Application OS Kernel Application Application User Kernel IPC Threads Address Spaces Scheduler L4 Hardware interrupt page-fault / exception ★ not to scale 14

  15. Darbat • Decompose Darwin kernel • Tackle complexity problem • Add flexibility • Maintain (or improve) performance • All with binary compatibility 15

  16. Darbat Model UNIX App OS X App BSD stub BSD stub BSD BSD Drv. Stub Drv. Stub I/O Kit I/O Kit Mach xnuglue Mach xnuglue User Kernel L4 timer interrupt Hardware 16

  17. XNU on L4 page faults syscalls timer int. mask I/O Kit exception ISR Thread Work-loop Thread Mach 17

  18. Server Consolidation xnu xnu • Multiple OS instances • Kernel support I/O Kit • Simplified driver model User Kernel L4 Hardware 18

  19. Crashable Drivers • Drivers crash xnu ‣ Holding locks ‣ Hogging resources Network • Can isolate drivers Disk Stack Stack ‣ and keep performance User Kernel • Some devices still L4 critical Hardware 19

  20. VM Aware Scheduling Application Application Application Application priority Application xnu xnu xnu User Kernel L4 Hardware 20

  21. Reliable Servers • Microkernel is very xnu Key Mgr. resilient • Protect data from 3rd party modules I/O Kit Watchdog • Ensure reliable User execution of code Kernel • Cheaper software L4 solutions Hardware 21

  22. Heterogeneous Systems xnu • L4 is OS (everything?) Wombat agnostic Linux ‣ Linux I/O Kit ‣ *BSD • Share devices User Kernel • Share file systems L4 Hardware 22

  23. System Call Performance Mac OS X 10.4.7 Darbat 0.2 UNIX App UNIX App ~2500 cycles ~2400 cycles xnu User Kernel User xnu Kernel L4 Hardware Hardware mach_msg null operation 23

  24. In-task Synchronisation Mac OS X 10.4.7 Darbat UNIX App UNIX App ~17,000 cycles ~6,500 cycles User User Kernel Kernel xnu L4 Hardware Hardware pthreads synchronisation 24

  25. IPC Optimisation OS X OS X App App • L4 IPC is a subset of Mach IPC xnu • Applications rely on Mach semantics User Kernel • Optimisation for some L4 messages Hardware 25

  26. Kernel Scripting • Sometimes you just xnu need a hack • In-kernel scripts get Python messy I/O Kit • Scheduling and locks User are a pain Kernel • Don’t compromise the L4 whole system Hardware 26

  27. Lessons So Far • Darwin modularity • Binary compatibility • Mac OS X has bugs • Performance • Debugging 27

  28. Future Work? • Further decomposition • Improved xnu and I/O Kit bindings • Usable system! • Experiment with features • System benchmarks 28

  29. Summary • UNIX kernels are feature-packed • L4 is one option to address this problem • Extend UNIX kernel to meet modern usage Questions? 29

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend