https://medium.com/@Meela349588204/using-cows-to-explain-the...
If it runs on a $10 raspberry pi it will run fine on a $20,000 switch.
And then there are the high-availability (HA) requirements which typically lead to redundancy in software and hardware.
Cisco NXOS is Yocto. They planned to move to Fedora at some point. Might have by now.
Cumulus is Debian based. switchd is closed sourced ASIC driver.
Junos is now a FreeBSD VM running on a Linux boot not sure what version.
Sonic is Debian based IIRC.
OS10 (Dell / Force10 was NextBSD) but I think with OPX (open source OS10 that SONiC will replace - personal option) moved to Linux.
FoundryOS was custom (VXworks?) Current version is Broadcom Strata.
Extreme original was VXworks. Current is Linux based.
Cisco IOS XE/XR is Linux (Debian IIRC).
SwtichLight is Linux as well as the BSNOS with their open flow stuff on top.
Ubiquiti is Vyatta running on Linux.
That is a quick dump from meat cache.
Linux (and other Unix or Unix-like) kernels (and indeed full OS distributions) run fine on many low-end and embedded CPUs and hardware, and network switches are no exception.
OpenWRT is Linux-based and runs on extremely low-end switches such as home routers and access points.
Arista EOS is based on Fedora. (Of course Arista switches have real server CPUs and lots of memory. People do crazy things like running KVM on them.)
Juniper's Junos is based on BSD.
Remember that on a high-speed switch packets usually pass through the switching hardware without touching the switch CPU. Programmable switching chips like Tofino typically run pre-compiled pipelines that execute on-chip at line rate. The switch OS is primarily used for running management software that programs the hardware, runs the CLI, and/or provides other services. The OS can also run software to provide higher-level protocols and services such as BGP, DNS, or DHCP.
Most network equipment run their control plane using standard Intel CPUs, so running Linux isn't much of a strech.
Ten years ago switches were using 800 MHz single-core PowerPCs which was adequate to run Linux (although many were using VxWorks or whatever). Now the $400 switches are still wimpy but more expensive "disaggregated" switches are using Atoms or low-end Xeons.