Having an OS gives several orders of magnitude more functionality, and allows your code to use high-level APIs, rather than having to program all the way to the hardware by yourself. For example, if doing network programming, you can use the sockets API, without having to worry about the intracacies of the entire network stack. This can mean the difference between a few lines of code vs pages and pages of code, to do a basic network access.
Few boards in the Arduino Ecosystem have an OS. The primary exception is the ESP32 family that runs FreeRTOS right out of the box. Its main advantage is that it provides the facilities to create real time multitasking (and multi-core) programs in a more sophisticated way than standard millis-based Arduino multitasking.
Surely the multitude of official boards that use an Mbed OS-based core are worth a mention? This operating system runs on nearly every new board Arduino made over the last few years (going back to the release of the Nano 33 BLE in 2019).
OK, but they're not well represented at least in posts to this forum. ESP32 questions probably out number those for all the other boards combined .... by a factor of 10.
for most applications described on this forum, there is no advantage, even those that have multiple sub-functions that need to run independently without blocking
i was told a multitasking OS is a social management tool. before PCs, multiple people worked on the same computer, independently doing their work and each persons work independent of everyone else's
of course todays PC require multitasking because there are running many different applications independently of one another
the small projects i did work on involving multiple developers we divided along people boundaries, although their tasks did run independently of one another. i worked on an 8088 based digital terminal with a home grown multitasking priority based OS with data, signaling, user interface, front panel tasks.
of course it's always good to build applications in layers (e.g. communications stacks) and understanding lower and upper halves of drivers. but this is somewhat separate from multitasking
for many applications, it's often easier and economical to use a faster processor and more memory to make things easier. but i've often had to develop signal processing applications that were constrained by both processing speed and memory. having an OS would have consumed both
i have experience not only with multi-tasking, but with applications having multiple-processors which is the next level of saving one's sanity
of course opinions will vary depending on the set of tools in the toolbox and experience with those tools
Most of this is achieved through libraries in the bare-metal coding.
A real OS offers more opprtunities at the cost of that the OS itself requires quite a lot of RAM.
So only microcontrolles which are under the aspect of available RAM/flash-ROM no more "micro" but "meso" because of having 200 kB of RAM or even more and have MBs of flash-ROM
could make use of a still micro-OS" compared to Windows or IOs.
So if you really need an OS because beside controlling some device you want to
copy logfiles through a network-connection to your computer while the device is going on controlling
or things like that
you could use a RaspBerry Pi or a bananaPi
best regards Stefan