SlideShare a Scribd company logo
1 of 20
Download to read offline
NetBSD and Linux for Embedded Systems




Mahendra M
Mahendra_M@infosys.com
http://www.infosys.com


This work is licensed under a Creative Commons License
http://creativecommons.org/licenses/by-sa/2.5/
About the talk

   This talk is NOT about to compare NetBSD and Linux and
    find out which is better.
    –   We shall compare – but not criticize !!
   We shall try to understand both systems in their own merit
   It is about sharing our experiences with both the systems –
    more from a embedded & telecom OS perspective.
   We hope to help you choose.
Agenda
   A short introduction to NetBSD and Linux based systems
   Suitability for embedded systems
   Introduction to the features available in NB and Linux
    –   Specifically for Embedded Systems
   Feature wise comparison of the two kernels
    –   Core architecture, Threading model, Real time capabilities,
        modularity, performance, ease of deployment, portability
   Linux capabilities.
   NetBSD Capabilities
    –   Kqueue : Event notification framework
   Availability of Code for future needs
   Feasibility and time to market along with License issues.
About the Systems
   Linux
    –   Refers only to the kernel
    –   Distributions are built around it. ( distros available for
        embedded systems )
    –   Has a history of around 15 years
    –   Is under the GPL license ( v2.0 ) and supports binary modules.
   NetBSD
    –   A BSD “ distribution” targeted at portability.
    –   Includes a kernel, libraries, config tools, scripts and build
        systems.
    –   Targeted at portability
    –   The BSD systems have had a history of around 25 years.
    –   Is under a BSD license.
Common stuff ...
   Highly portable – ports exist for a large number of
    architectures and reference boards.
   Both are POSIX compliant
   Good VM, Networking, Threading subsystems
   Both have been time tested in the market
   Active development happening
    –   Directly on Linux kernel – on multiple trees maintained by
        different people.
    –   NetBSD tend to let features stabilize on FreeBSD/OpenBSD
        and then pick it up :-)
   Let us get on with the differences....
Memory foot print
   Linux is slowly getting bloated.
    –   There are projects that are working on reducing the size of
        Linux kernel
    –   “ Linux Tiny” project provides a set of patches that can be
         applied to the Linux kernel to reduce the kernel size (built
         image and run time memory requirements)
   NetBSD projects boast of reduced kernel size.
    –   TINY configuration file is distributed along with the source.
   Both kernels can be easily reduced to a size of less than
    1MB ( uncompressed : ~900k, compressed : ~400k )
   With sufficient hacking around, it can be reduced even
    further.
Process Scheduling
   Both OS follow a similar model in running user space
    processes.
    –   Time slice based – and O(1) in nature.
    –   They have priority based levels and processes are placed on
        these levels based on their priority
    –   Both support dynamic priority modification based on
        interactiveness of a process
            Not needed for embedded systems – and can be turned off at
             compile time.
    –   Both support the same user space priorities (40)
   Linux has two run-queues : An active and an expired run-
    queue.
   Linux also has a run-queue per CPU – for SMP boxes.
Process Run-queue


RunQueue
                     Doubly linked lists of tasks
           Active
                     Task 1   Task 2   ...      Task N   [Priority:   1]

                                                              ...
                     Task 1   Task 2   Task M            [Priority:140]

           Expired
                              ...

                      ...
           Migration Thread
                                             From kernel/sched.c
Other stuff ...
   Kernel pre-emption.
    –   Linux kernel supports kernel pre-emption, but only at pre-
        emptible points inside in the kernel.
    –   There are still areas within the kernel which cannot be pre-
        empted.
    –   NetBSD does not support kernel pre-emption.
            Hence real-time support is pretty poor on NetBSD systems
   SMP Support ( not really critical in embedded systems )
    –   Very good in Linux.
    –   Worked upon in NetBSD.
Real-time performance
   Hard real-time performance
    –   Not available in both kernels by default.
    –   FSM labs provides patches to the Linux kernel ( under GPL )
        and commercial patches to NetBSD.
            Works by running Linux/NetBSD kernel as low priority tasks
             under a real time kernel.
   Soft real-time performance.
    –   Linux is pretty good in providing soft real time facilities.
    –   In addition to the 40 user land priorities, Linux provides an
        additional 100 real-time priorities
    –   Linux supports two soft real time scheduling options
            SCHED_FIFO – First in first out
            SCHED_RR – Round robin
    –   Real time tasks cannot be pre-empted.
Threading models
   Both kernels are thread aware and are POSIX compliant
   They support different threading models
    –   This is where the difference starts and things get interesting..
   Linux
    –   Supports 1:1 model of threading ( NPTL )
    –   The kernel does not distinguish between threads and
        processes
            A process is a group of thread ids – thats it.
    –   All threads in a process are visible as tasks to the kernel and
        active threads are allocated time-slices for scheduling.
            All active threads will get their time-slices
    –   Can set real time priorities to tasks.
    –   APIs are available for real time threads handling
Threading models ( contd .. )
   NetBSD
    –   Treats threads (lwp) and processes differently
    –   Supports Scheduler Activations.
            m:n model of threading
    –   Not all threads are visible to the kernel scheduler. User space
        code takes part in telling the kernel which thread to schedule.
    –   The threads in a process have co-operative scheduling.
            A thread can keep running for most of the time – careful
             programing required.
   Both groups had debated the models before taking up their
    approaches. Both methods are “ claimed” to be better than
    the other.
   Today, Linux seems to have better thread/process creation,
    spawning and context switching times.
Debugging support
   NetBSD has much better debugging support.
    –   DDB – an in-kernel debugger
    –   Supports kernel crash dumps
    –   Supports KGDB (source level debug) – remote debugging.
   Linux
    –   Patches available for crash dumps and KDB & KGDB (not
        available for all architectures)
    –   Linux Trace Toolkit, UML etc. are also available methods.
    –   Has “ Kernel Hacking” Option in kernel configuration
            Allows debugging using “ Magic SysRQs” , Debugging of actions
             like memory allocations, file systems, highmem, stack overflows,
             page allocations etc.
            Also allows stats collection for some modules.
    –   Also, early printk() support is pretty recent.
Flash Devices and File Systems
   Support is poor in NetBSD
   Linux supports
    –   Advanced MTD support ( device concatenation, FTL, NFTL )
    –   JFFS2 ( JFFS3 is being worked on )
    –   RAM file systems and ramdisk support
    –   Supports initrd
   In NetBSD
    –   OpenSource implementations of the above are not available.
        ( Commercial products are available )
    –   Results in considerable lead time in development.
    –   Supports MFS ( not memory efficient ) : tmpfs is being worked
        upon
    –   For boot time, it allows embedding a file-system into the kernel
KQueue : Event notification mechanism
   NetBSD supports a generic event notification framework –
    kqueues.
   Excellent replacement for select() / poll() APIs.
    –   No need to pass entire descriptor set to each call.
    –   On return, applications need not check all file descriptors for
        updates.
    –   Reduces data copying ( fd list from kernel to user space and
        vice-versa )
   Can handle multiple types of events.
    –   Signals, Vnode/Process monitoring, Timer events etc.
   Can club multiple occurrences of an event into a single event
   New event types can be easily added.
   All with just two system calls !!
Build systems and configuration
   NetBSD is better
    –   The entire system : kernel, compilers and tools, libraries and
        applications can be compiled ( native or cross platform ) using
        a single script – build.sh
    –   The same script can build distributions, tarballs, archives and
        can also update existing systems and install fresh systems.
    –   Adding new components to the build framework is extremely
        easy.
   Linux – Such systems exist but it is not as flexible as BSD
   Both NetBSD and Linux provide different configuration
    mechanisms.
    –   NetBSD builds a device tree format.
    –   Linux provides a GUI interface for configuring the kernel...
Other differences.
   Linux kernel code throws out lot of warnings during
    compilation. NetBSD is very clean in this aspect.
   Linux supports MMU Less operations.
   Loadable kernel modules
    –   Better supported in Linux.
   Better device support in Linux
   With 2.6 kernel, the device driver model has vastly improved
    ( attend other talks at FOSS.in for more details )
   Portability has been a design goal for NetBSD.
   Development models are vastly different :-)
    –   NetBSD is more “ cathedral” like !!
   In Linux, you get answers easily :-)
Business related
   License (violation) is a serious cause of concern
    –   BSD License is very liberal
    –   One of the main reasons why telecom companies go for BSD
        – eg: Juniper ( JUNOS )
   Protocol stacks and third party code
    –   Are available usually for most BSDs and Linux.
    –   To be more portable, they tend to ignore benefits of one OS
   New device support
    –   Vendors of new devices like Network Processors, etc. release
        code only/mainly for Linux ( kernel modules etc. ).
    –   Extra effort is required in such cases to port things to NetBSD.
   In case of Linux, extra time is required in selecting and
    integrating components of the system.
Links
   http://linux-bangalore.org/blug/meetings/200401/scheduler-2.6.pdf
   http://www.netbsd.org/ - One site for all NetBSD stuff
   http://people.freebsd.org/~jlemon/papers/kqueue.pdf       - Kqueue design
   http://camars.kaist.ac.kr/courses/530/97/Readings/scheduler-act.pdf - SA design
   http://josh.trancesoftware.com/linux/ - Details of Linux 2.6 scheduler
   http://www.wasabisystems.com/gpl/linux.htm - A comparison
   http://bulk.fefe.de/scalability/   - Started a Battle and cleanup !!
   http://lkcd.sourceforge.net/
   http://kgdb.sf.net/
   http://oss.sgi.com/projects/kdb/
   http://www.linuxjournal.com/article/3829 - Using Linux Trace Toolkit
   http://www.opersys.com/LTT
   http://netbsd-soc.sourceforge.net/projects/tmpfs/ - TMPFS project page
   http://www.selenic.com/linux-tiny      - Linux Tiny home page
Finally ...
   Questions ??
   Thanks to
    –   Organizers for giving me a chance to speak at FOSS.in
    –   NetBSD and Linux developers who helped me during my work
    –   Linux kernel team for doing a wonderful job !!
   Special thanks to YOU for listening...


                       You can contact me at :
                    Mahendra_M@infosys.com

More Related Content

What's hot

Redhat ha cluster with pacemaker
Redhat ha cluster with pacemakerRedhat ha cluster with pacemaker
Redhat ha cluster with pacemakerIndika Dias
 
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, XilinxXPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, XilinxThe Linux Foundation
 
SR-IOV+KVM on Debian/Stable
SR-IOV+KVM on Debian/StableSR-IOV+KVM on Debian/Stable
SR-IOV+KVM on Debian/Stablejuet-y
 
Implementation & Comparison Of Rdma Over Ethernet
Implementation & Comparison Of Rdma Over EthernetImplementation & Comparison Of Rdma Over Ethernet
Implementation & Comparison Of Rdma Over EthernetJames Wernicke
 
BPF Internals (eBPF)
BPF Internals (eBPF)BPF Internals (eBPF)
BPF Internals (eBPF)Brendan Gregg
 
Ceph Performance and Sizing Guide
Ceph Performance and Sizing GuideCeph Performance and Sizing Guide
Ceph Performance and Sizing GuideJose De La Rosa
 
Apache Spark Internals
Apache Spark InternalsApache Spark Internals
Apache Spark InternalsKnoldus Inc.
 
Canonicalが支える、さくっと使えるUbuntu OpenStack - OpenStack Day in ITpro EXPO 2014
Canonicalが支える、さくっと使えるUbuntu OpenStack - OpenStack Day in ITpro EXPO 2014Canonicalが支える、さくっと使えるUbuntu OpenStack - OpenStack Day in ITpro EXPO 2014
Canonicalが支える、さくっと使えるUbuntu OpenStack - OpenStack Day in ITpro EXPO 2014VirtualTech Japan Inc.
 
Cours système d’exploitation partie3
Cours système d’exploitation partie3Cours système d’exploitation partie3
Cours système d’exploitation partie3manou2008
 
10年効く分散ファイルシステム技術 GlusterFS & Red Hat Storage
10年効く分散ファイルシステム技術 GlusterFS & Red Hat Storage10年効く分散ファイルシステム技術 GlusterFS & Red Hat Storage
10年効く分散ファイルシステム技術 GlusterFS & Red Hat StorageEtsuji Nakai
 
マルチコアとネットワークスタックの高速化技法
マルチコアとネットワークスタックの高速化技法マルチコアとネットワークスタックの高速化技法
マルチコアとネットワークスタックの高速化技法Takuya ASADA
 
Linux BPF Superpowers
Linux BPF SuperpowersLinux BPF Superpowers
Linux BPF SuperpowersBrendan Gregg
 
OVS VXLAN Network Accelaration on OpenStack (VXLAN offload and DPDK) - OpenSt...
OVS VXLAN Network Accelaration on OpenStack (VXLAN offload and DPDK) - OpenSt...OVS VXLAN Network Accelaration on OpenStack (VXLAN offload and DPDK) - OpenSt...
OVS VXLAN Network Accelaration on OpenStack (VXLAN offload and DPDK) - OpenSt...VirtualTech Japan Inc.
 

What's hot (20)

Redhat ha cluster with pacemaker
Redhat ha cluster with pacemakerRedhat ha cluster with pacemaker
Redhat ha cluster with pacemaker
 
Ixgbe internals
Ixgbe internalsIxgbe internals
Ixgbe internals
 
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, XilinxXPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
 
SR-IOV+KVM on Debian/Stable
SR-IOV+KVM on Debian/StableSR-IOV+KVM on Debian/Stable
SR-IOV+KVM on Debian/Stable
 
Dpdk performance
Dpdk performanceDpdk performance
Dpdk performance
 
Implementation & Comparison Of Rdma Over Ethernet
Implementation & Comparison Of Rdma Over EthernetImplementation & Comparison Of Rdma Over Ethernet
Implementation & Comparison Of Rdma Over Ethernet
 
Linux Namespaces
Linux NamespacesLinux Namespaces
Linux Namespaces
 
CephFS Update
CephFS UpdateCephFS Update
CephFS Update
 
BPF Internals (eBPF)
BPF Internals (eBPF)BPF Internals (eBPF)
BPF Internals (eBPF)
 
Ceph Performance and Sizing Guide
Ceph Performance and Sizing GuideCeph Performance and Sizing Guide
Ceph Performance and Sizing Guide
 
Apache Spark Internals
Apache Spark InternalsApache Spark Internals
Apache Spark Internals
 
Canonicalが支える、さくっと使えるUbuntu OpenStack - OpenStack Day in ITpro EXPO 2014
Canonicalが支える、さくっと使えるUbuntu OpenStack - OpenStack Day in ITpro EXPO 2014Canonicalが支える、さくっと使えるUbuntu OpenStack - OpenStack Day in ITpro EXPO 2014
Canonicalが支える、さくっと使えるUbuntu OpenStack - OpenStack Day in ITpro EXPO 2014
 
Linux aio
Linux aioLinux aio
Linux aio
 
NDT-TKU
NDT-TKUNDT-TKU
NDT-TKU
 
Cours système d’exploitation partie3
Cours système d’exploitation partie3Cours système d’exploitation partie3
Cours système d’exploitation partie3
 
10年効く分散ファイルシステム技術 GlusterFS & Red Hat Storage
10年効く分散ファイルシステム技術 GlusterFS & Red Hat Storage10年効く分散ファイルシステム技術 GlusterFS & Red Hat Storage
10年効く分散ファイルシステム技術 GlusterFS & Red Hat Storage
 
マルチコアとネットワークスタックの高速化技法
マルチコアとネットワークスタックの高速化技法マルチコアとネットワークスタックの高速化技法
マルチコアとネットワークスタックの高速化技法
 
Linux BPF Superpowers
Linux BPF SuperpowersLinux BPF Superpowers
Linux BPF Superpowers
 
OVS VXLAN Network Accelaration on OpenStack (VXLAN offload and DPDK) - OpenSt...
OVS VXLAN Network Accelaration on OpenStack (VXLAN offload and DPDK) - OpenSt...OVS VXLAN Network Accelaration on OpenStack (VXLAN offload and DPDK) - OpenSt...
OVS VXLAN Network Accelaration on OpenStack (VXLAN offload and DPDK) - OpenSt...
 
Ceph on arm64 upload
Ceph on arm64   uploadCeph on arm64   upload
Ceph on arm64 upload
 

Viewers also liked

Advanced task management with Celery
Advanced task management with CeleryAdvanced task management with Celery
Advanced task management with CeleryMahendra M
 
Open World of #OSS and #HealthTech
Open World of #OSS and #HealthTechOpen World of #OSS and #HealthTech
Open World of #OSS and #HealthTechPiyush Kumar
 
Linux, Android and Open Source in the Mobile Environment
Linux, Android and Open Source in the Mobile EnvironmentLinux, Android and Open Source in the Mobile Environment
Linux, Android and Open Source in the Mobile EnvironmentAlison Chaiken
 
Wind River Chumby Motorola Stacatto
Wind River   Chumby   Motorola   StacattoWind River   Chumby   Motorola   Stacatto
Wind River Chumby Motorola StacattoMarco Thompson
 
Developer Day 2014 - 4 - wind river - iot business and technology trends
Developer Day 2014 - 4 - wind river - iot business and technology trendsDeveloper Day 2014 - 4 - wind river - iot business and technology trends
Developer Day 2014 - 4 - wind river - iot business and technology trendsThibault Cantegrel
 
Emotion Economy: Ethnography as Corporate Strategy (Kelly Goto at Enterprise ...
Emotion Economy: Ethnography as Corporate Strategy (Kelly Goto at Enterprise ...Emotion Economy: Ethnography as Corporate Strategy (Kelly Goto at Enterprise ...
Emotion Economy: Ethnography as Corporate Strategy (Kelly Goto at Enterprise ...Rosenfeld Media
 
Embedded Linux Evolution | Turing Techtalk
Embedded Linux Evolution | Turing TechtalkEmbedded Linux Evolution | Turing Techtalk
Embedded Linux Evolution | Turing TechtalkPersistent Systems Ltd.
 
Yocto Project Open Source Build System and Collaboration Initiative
Yocto Project Open Source Build System and Collaboration InitiativeYocto Project Open Source Build System and Collaboration Initiative
Yocto Project Open Source Build System and Collaboration InitiativeMarcelo Sanz
 
PyCon India 2012: Celery Talk
PyCon India 2012: Celery TalkPyCon India 2012: Celery Talk
PyCon India 2012: Celery TalkPiyush Kumar
 
Embedded Os [Linux & Co.]
Embedded Os [Linux & Co.]Embedded Os [Linux & Co.]
Embedded Os [Linux & Co.]Ionela
 
Importance of ‘Centralized Event collection’ and BigData platform for Analysis !
Importance of ‘Centralized Event collection’ and BigData platform for Analysis !Importance of ‘Centralized Event collection’ and BigData platform for Analysis !
Importance of ‘Centralized Event collection’ and BigData platform for Analysis !Piyush Kumar
 
"In love with Open Source : Past, Present and Future" : Keynote OSDConf 2014
"In love with Open Source : Past, Present and Future" : Keynote OSDConf 2014"In love with Open Source : Past, Present and Future" : Keynote OSDConf 2014
"In love with Open Source : Past, Present and Future" : Keynote OSDConf 2014Piyush Kumar
 
A Market Update on Embedded/Real-Time Operating Systems
A Market Update on Embedded/Real-Time Operating SystemsA Market Update on Embedded/Real-Time Operating Systems
A Market Update on Embedded/Real-Time Operating SystemsVDC Research Group
 
Filippa K - Goto Market Strategy 2016
Filippa K - Goto Market Strategy 2016Filippa K - Goto Market Strategy 2016
Filippa K - Goto Market Strategy 2016Thassilo Nowacka
 
Radisys_Wind River_C-RAN Webinar_June 26_14
Radisys_Wind River_C-RAN Webinar_June 26_14Radisys_Wind River_C-RAN Webinar_June 26_14
Radisys_Wind River_C-RAN Webinar_June 26_14Radisys Corporation
 
An Introduction to Celery
An Introduction to CeleryAn Introduction to Celery
An Introduction to CeleryIdan Gazit
 
Introduction to Embedded Systems
Introduction to Embedded SystemsIntroduction to Embedded Systems
Introduction to Embedded SystemsAnil Kumar Pugalia
 

Viewers also liked (19)

Advanced task management with Celery
Advanced task management with CeleryAdvanced task management with Celery
Advanced task management with Celery
 
Open World of #OSS and #HealthTech
Open World of #OSS and #HealthTechOpen World of #OSS and #HealthTech
Open World of #OSS and #HealthTech
 
Linux, Android and Open Source in the Mobile Environment
Linux, Android and Open Source in the Mobile EnvironmentLinux, Android and Open Source in the Mobile Environment
Linux, Android and Open Source in the Mobile Environment
 
Wind River Chumby Motorola Stacatto
Wind River   Chumby   Motorola   StacattoWind River   Chumby   Motorola   Stacatto
Wind River Chumby Motorola Stacatto
 
Developer Day 2014 - 4 - wind river - iot business and technology trends
Developer Day 2014 - 4 - wind river - iot business and technology trendsDeveloper Day 2014 - 4 - wind river - iot business and technology trends
Developer Day 2014 - 4 - wind river - iot business and technology trends
 
Emotion Economy: Ethnography as Corporate Strategy (Kelly Goto at Enterprise ...
Emotion Economy: Ethnography as Corporate Strategy (Kelly Goto at Enterprise ...Emotion Economy: Ethnography as Corporate Strategy (Kelly Goto at Enterprise ...
Emotion Economy: Ethnography as Corporate Strategy (Kelly Goto at Enterprise ...
 
Embedded Linux Evolution | Turing Techtalk
Embedded Linux Evolution | Turing TechtalkEmbedded Linux Evolution | Turing Techtalk
Embedded Linux Evolution | Turing Techtalk
 
Yocto Project Open Source Build System and Collaboration Initiative
Yocto Project Open Source Build System and Collaboration InitiativeYocto Project Open Source Build System and Collaboration Initiative
Yocto Project Open Source Build System and Collaboration Initiative
 
PyCon India 2012: Celery Talk
PyCon India 2012: Celery TalkPyCon India 2012: Celery Talk
PyCon India 2012: Celery Talk
 
Embedded Os [Linux & Co.]
Embedded Os [Linux & Co.]Embedded Os [Linux & Co.]
Embedded Os [Linux & Co.]
 
Importance of ‘Centralized Event collection’ and BigData platform for Analysis !
Importance of ‘Centralized Event collection’ and BigData platform for Analysis !Importance of ‘Centralized Event collection’ and BigData platform for Analysis !
Importance of ‘Centralized Event collection’ and BigData platform for Analysis !
 
"In love with Open Source : Past, Present and Future" : Keynote OSDConf 2014
"In love with Open Source : Past, Present and Future" : Keynote OSDConf 2014"In love with Open Source : Past, Present and Future" : Keynote OSDConf 2014
"In love with Open Source : Past, Present and Future" : Keynote OSDConf 2014
 
A Market Update on Embedded/Real-Time Operating Systems
A Market Update on Embedded/Real-Time Operating SystemsA Market Update on Embedded/Real-Time Operating Systems
A Market Update on Embedded/Real-Time Operating Systems
 
Filippa K - Goto Market Strategy 2016
Filippa K - Goto Market Strategy 2016Filippa K - Goto Market Strategy 2016
Filippa K - Goto Market Strategy 2016
 
Iot survey
Iot surveyIot survey
Iot survey
 
Radisys_Wind River_C-RAN Webinar_June 26_14
Radisys_Wind River_C-RAN Webinar_June 26_14Radisys_Wind River_C-RAN Webinar_June 26_14
Radisys_Wind River_C-RAN Webinar_June 26_14
 
An Introduction to Celery
An Introduction to CeleryAn Introduction to Celery
An Introduction to Celery
 
Introduction to Embedded Systems
Introduction to Embedded SystemsIntroduction to Embedded Systems
Introduction to Embedded Systems
 
Toolchain
ToolchainToolchain
Toolchain
 

Similar to NetBSD and Linux for Embedded Systems

Introduction to NetBSD kernel
Introduction to NetBSD kernelIntroduction to NetBSD kernel
Introduction to NetBSD kernelMahendra M
 
introduction.pdf
introduction.pdfintroduction.pdf
introduction.pdfxiso
 
Linux Container Brief for IEEE WG P2302
Linux Container Brief for IEEE WG P2302Linux Container Brief for IEEE WG P2302
Linux Container Brief for IEEE WG P2302Boden Russell
 
Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)Vivian Vhaves
 
Lightweight Virtualization in Linux
Lightweight Virtualization in LinuxLightweight Virtualization in Linux
Lightweight Virtualization in LinuxSadegh Dorri N.
 
Linux scheduling and input and output
Linux scheduling and input and outputLinux scheduling and input and output
Linux scheduling and input and outputSanidhya Chugh
 
Realizing Linux Containers (LXC)
Realizing Linux Containers (LXC)Realizing Linux Containers (LXC)
Realizing Linux Containers (LXC)Boden Russell
 
Virtual Distro Dispatcher - A costless distributed virtual environment from T...
Virtual Distro Dispatcher - A costless distributed virtual environment from T...Virtual Distro Dispatcher - A costless distributed virtual environment from T...
Virtual Distro Dispatcher - A costless distributed virtual environment from T...Flavio Bertini
 
multi-threading
multi-threadingmulti-threading
multi-threadingEzzat Gul
 
Linux for embedded_systems
Linux for embedded_systemsLinux for embedded_systems
Linux for embedded_systemsVandana Salve
 
Enea Linux and LWRT FTF China 2012
Enea Linux and LWRT FTF China 2012Enea Linux and LWRT FTF China 2012
Enea Linux and LWRT FTF China 2012EneaSoftware
 
Running Applications on the NetBSD Rump Kernel by Justin Cormack
Running Applications on the NetBSD Rump Kernel by Justin Cormack Running Applications on the NetBSD Rump Kernel by Justin Cormack
Running Applications on the NetBSD Rump Kernel by Justin Cormack eurobsdcon
 

Similar to NetBSD and Linux for Embedded Systems (20)

Introduction to NetBSD kernel
Introduction to NetBSD kernelIntroduction to NetBSD kernel
Introduction to NetBSD kernel
 
introduction.pdf
introduction.pdfintroduction.pdf
introduction.pdf
 
Linux Container Brief for IEEE WG P2302
Linux Container Brief for IEEE WG P2302Linux Container Brief for IEEE WG P2302
Linux Container Brief for IEEE WG P2302
 
Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Lightweight Virtualization in Linux
Lightweight Virtualization in LinuxLightweight Virtualization in Linux
Lightweight Virtualization in Linux
 
ubantu ppt.pptx
ubantu ppt.pptxubantu ppt.pptx
ubantu ppt.pptx
 
Ubuntu OS Presentation
Ubuntu OS PresentationUbuntu OS Presentation
Ubuntu OS Presentation
 
First steps on CentOs7
First steps on CentOs7First steps on CentOs7
First steps on CentOs7
 
The Linux System
The Linux SystemThe Linux System
The Linux System
 
Chapter 6 os
Chapter 6 osChapter 6 os
Chapter 6 os
 
Linux scheduling and input and output
Linux scheduling and input and outputLinux scheduling and input and output
Linux scheduling and input and output
 
Realizing Linux Containers (LXC)
Realizing Linux Containers (LXC)Realizing Linux Containers (LXC)
Realizing Linux Containers (LXC)
 
Virtual Distro Dispatcher - A costless distributed virtual environment from T...
Virtual Distro Dispatcher - A costless distributed virtual environment from T...Virtual Distro Dispatcher - A costless distributed virtual environment from T...
Virtual Distro Dispatcher - A costless distributed virtual environment from T...
 
multi-threading
multi-threadingmulti-threading
multi-threading
 
Linux for embedded_systems
Linux for embedded_systemsLinux for embedded_systems
Linux for embedded_systems
 
Enea Linux and LWRT FTF China 2012
Enea Linux and LWRT FTF China 2012Enea Linux and LWRT FTF China 2012
Enea Linux and LWRT FTF China 2012
 
Running Applications on the NetBSD Rump Kernel by Justin Cormack
Running Applications on the NetBSD Rump Kernel by Justin Cormack Running Applications on the NetBSD Rump Kernel by Justin Cormack
Running Applications on the NetBSD Rump Kernel by Justin Cormack
 
.ppt
.ppt.ppt
.ppt
 

Recently uploaded

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 

Recently uploaded (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

NetBSD and Linux for Embedded Systems

  • 1. NetBSD and Linux for Embedded Systems Mahendra M Mahendra_M@infosys.com http://www.infosys.com This work is licensed under a Creative Commons License http://creativecommons.org/licenses/by-sa/2.5/
  • 2. About the talk  This talk is NOT about to compare NetBSD and Linux and find out which is better. – We shall compare – but not criticize !!  We shall try to understand both systems in their own merit  It is about sharing our experiences with both the systems – more from a embedded & telecom OS perspective.  We hope to help you choose.
  • 3. Agenda  A short introduction to NetBSD and Linux based systems  Suitability for embedded systems  Introduction to the features available in NB and Linux – Specifically for Embedded Systems  Feature wise comparison of the two kernels – Core architecture, Threading model, Real time capabilities, modularity, performance, ease of deployment, portability  Linux capabilities.  NetBSD Capabilities – Kqueue : Event notification framework  Availability of Code for future needs  Feasibility and time to market along with License issues.
  • 4. About the Systems  Linux – Refers only to the kernel – Distributions are built around it. ( distros available for embedded systems ) – Has a history of around 15 years – Is under the GPL license ( v2.0 ) and supports binary modules.  NetBSD – A BSD “ distribution” targeted at portability. – Includes a kernel, libraries, config tools, scripts and build systems. – Targeted at portability – The BSD systems have had a history of around 25 years. – Is under a BSD license.
  • 5. Common stuff ...  Highly portable – ports exist for a large number of architectures and reference boards.  Both are POSIX compliant  Good VM, Networking, Threading subsystems  Both have been time tested in the market  Active development happening – Directly on Linux kernel – on multiple trees maintained by different people. – NetBSD tend to let features stabilize on FreeBSD/OpenBSD and then pick it up :-)  Let us get on with the differences....
  • 6. Memory foot print  Linux is slowly getting bloated. – There are projects that are working on reducing the size of Linux kernel – “ Linux Tiny” project provides a set of patches that can be applied to the Linux kernel to reduce the kernel size (built image and run time memory requirements)  NetBSD projects boast of reduced kernel size. – TINY configuration file is distributed along with the source.  Both kernels can be easily reduced to a size of less than 1MB ( uncompressed : ~900k, compressed : ~400k )  With sufficient hacking around, it can be reduced even further.
  • 7. Process Scheduling  Both OS follow a similar model in running user space processes. – Time slice based – and O(1) in nature. – They have priority based levels and processes are placed on these levels based on their priority – Both support dynamic priority modification based on interactiveness of a process  Not needed for embedded systems – and can be turned off at compile time. – Both support the same user space priorities (40)  Linux has two run-queues : An active and an expired run- queue.  Linux also has a run-queue per CPU – for SMP boxes.
  • 8. Process Run-queue RunQueue Doubly linked lists of tasks Active Task 1 Task 2 ... Task N [Priority: 1] ... Task 1 Task 2 Task M [Priority:140] Expired ... ... Migration Thread From kernel/sched.c
  • 9. Other stuff ...  Kernel pre-emption. – Linux kernel supports kernel pre-emption, but only at pre- emptible points inside in the kernel. – There are still areas within the kernel which cannot be pre- empted. – NetBSD does not support kernel pre-emption.  Hence real-time support is pretty poor on NetBSD systems  SMP Support ( not really critical in embedded systems ) – Very good in Linux. – Worked upon in NetBSD.
  • 10. Real-time performance  Hard real-time performance – Not available in both kernels by default. – FSM labs provides patches to the Linux kernel ( under GPL ) and commercial patches to NetBSD.  Works by running Linux/NetBSD kernel as low priority tasks under a real time kernel.  Soft real-time performance. – Linux is pretty good in providing soft real time facilities. – In addition to the 40 user land priorities, Linux provides an additional 100 real-time priorities – Linux supports two soft real time scheduling options  SCHED_FIFO – First in first out  SCHED_RR – Round robin – Real time tasks cannot be pre-empted.
  • 11. Threading models  Both kernels are thread aware and are POSIX compliant  They support different threading models – This is where the difference starts and things get interesting..  Linux – Supports 1:1 model of threading ( NPTL ) – The kernel does not distinguish between threads and processes  A process is a group of thread ids – thats it. – All threads in a process are visible as tasks to the kernel and active threads are allocated time-slices for scheduling.  All active threads will get their time-slices – Can set real time priorities to tasks. – APIs are available for real time threads handling
  • 12. Threading models ( contd .. )  NetBSD – Treats threads (lwp) and processes differently – Supports Scheduler Activations.  m:n model of threading – Not all threads are visible to the kernel scheduler. User space code takes part in telling the kernel which thread to schedule. – The threads in a process have co-operative scheduling.  A thread can keep running for most of the time – careful programing required.  Both groups had debated the models before taking up their approaches. Both methods are “ claimed” to be better than the other.  Today, Linux seems to have better thread/process creation, spawning and context switching times.
  • 13. Debugging support  NetBSD has much better debugging support. – DDB – an in-kernel debugger – Supports kernel crash dumps – Supports KGDB (source level debug) – remote debugging.  Linux – Patches available for crash dumps and KDB & KGDB (not available for all architectures) – Linux Trace Toolkit, UML etc. are also available methods. – Has “ Kernel Hacking” Option in kernel configuration  Allows debugging using “ Magic SysRQs” , Debugging of actions like memory allocations, file systems, highmem, stack overflows, page allocations etc.  Also allows stats collection for some modules. – Also, early printk() support is pretty recent.
  • 14. Flash Devices and File Systems  Support is poor in NetBSD  Linux supports – Advanced MTD support ( device concatenation, FTL, NFTL ) – JFFS2 ( JFFS3 is being worked on ) – RAM file systems and ramdisk support – Supports initrd  In NetBSD – OpenSource implementations of the above are not available. ( Commercial products are available ) – Results in considerable lead time in development. – Supports MFS ( not memory efficient ) : tmpfs is being worked upon – For boot time, it allows embedding a file-system into the kernel
  • 15. KQueue : Event notification mechanism  NetBSD supports a generic event notification framework – kqueues.  Excellent replacement for select() / poll() APIs. – No need to pass entire descriptor set to each call. – On return, applications need not check all file descriptors for updates. – Reduces data copying ( fd list from kernel to user space and vice-versa )  Can handle multiple types of events. – Signals, Vnode/Process monitoring, Timer events etc.  Can club multiple occurrences of an event into a single event  New event types can be easily added.  All with just two system calls !!
  • 16. Build systems and configuration  NetBSD is better – The entire system : kernel, compilers and tools, libraries and applications can be compiled ( native or cross platform ) using a single script – build.sh – The same script can build distributions, tarballs, archives and can also update existing systems and install fresh systems. – Adding new components to the build framework is extremely easy.  Linux – Such systems exist but it is not as flexible as BSD  Both NetBSD and Linux provide different configuration mechanisms. – NetBSD builds a device tree format. – Linux provides a GUI interface for configuring the kernel...
  • 17. Other differences.  Linux kernel code throws out lot of warnings during compilation. NetBSD is very clean in this aspect.  Linux supports MMU Less operations.  Loadable kernel modules – Better supported in Linux.  Better device support in Linux  With 2.6 kernel, the device driver model has vastly improved ( attend other talks at FOSS.in for more details )  Portability has been a design goal for NetBSD.  Development models are vastly different :-) – NetBSD is more “ cathedral” like !!  In Linux, you get answers easily :-)
  • 18. Business related  License (violation) is a serious cause of concern – BSD License is very liberal – One of the main reasons why telecom companies go for BSD – eg: Juniper ( JUNOS )  Protocol stacks and third party code – Are available usually for most BSDs and Linux. – To be more portable, they tend to ignore benefits of one OS  New device support – Vendors of new devices like Network Processors, etc. release code only/mainly for Linux ( kernel modules etc. ). – Extra effort is required in such cases to port things to NetBSD.  In case of Linux, extra time is required in selecting and integrating components of the system.
  • 19. Links  http://linux-bangalore.org/blug/meetings/200401/scheduler-2.6.pdf  http://www.netbsd.org/ - One site for all NetBSD stuff  http://people.freebsd.org/~jlemon/papers/kqueue.pdf - Kqueue design  http://camars.kaist.ac.kr/courses/530/97/Readings/scheduler-act.pdf - SA design  http://josh.trancesoftware.com/linux/ - Details of Linux 2.6 scheduler  http://www.wasabisystems.com/gpl/linux.htm - A comparison  http://bulk.fefe.de/scalability/ - Started a Battle and cleanup !!  http://lkcd.sourceforge.net/  http://kgdb.sf.net/  http://oss.sgi.com/projects/kdb/  http://www.linuxjournal.com/article/3829 - Using Linux Trace Toolkit  http://www.opersys.com/LTT  http://netbsd-soc.sourceforge.net/projects/tmpfs/ - TMPFS project page  http://www.selenic.com/linux-tiny - Linux Tiny home page
  • 20. Finally ...  Questions ??  Thanks to – Organizers for giving me a chance to speak at FOSS.in – NetBSD and Linux developers who helped me during my work – Linux kernel team for doing a wonderful job !!  Special thanks to YOU for listening... You can contact me at : Mahendra_M@infosys.com