In embedded devices such as printer, switches, I am confused what the difference between the firmware and the operating system is. Are embedded devices operating systems similar
As others have pointed out, firmware is in non-volatile memory in a device. It contains the instructions that the device performs as it starts up from power-off or reset. This may be the entirety of the software on the device, or it may contain instructions to jump to instructions on some other component as for example when a PC's BIOS causes the processor to read the first sector on a hard disk drive (or floppy or CD-ROM) to discover which code to run next.
An operating system is code running on a device that provides services for applications to access the capabilities of the device. For example, it may provide time-slicing of the processor, a file system to access, input and output, and so on.
An embedded device does not need to supply an operating system to applications, but that may be an appropriate model for the manufacturer to use in writing the software. It is conceivable that a printer could have all of its firmware in one running program with some interrupt handlers, with no need to separate the web server from an OS. I don't know about that particular model.
The point is that an OS can exist in firmware, and firmware can exist without an OS. They are independent concepts.