DIfferences between firmware and middleware and device driver

driversfirmware

What are the relations and differences between firmware and middleware?

Wikipedia says

firmware is the combination of persistent memory and program code and data stored in it.[1] Typical examples of devices containing firmware are embedded systems (such as traffic lights, consumer appliances, and digital watches), computers, computer peripherals, mobile phones, and digital cameras. The firmware contained in these devices provides the control program for the device.

Middleware is computer software that provides services to software applications beyond those available from the operating system. It can be described as "software glue".[1] Middleware makes it easier for software developers to perform communication and input/output, so they can focus on the specific purpose of their application.

  1. I still don't understand the differences in their roles, relative to
    hardware, high-level software, operating system, etc.

    For example,

    Is BIOS firmware not middleware?

    Is a bootloader for an OS a firmware, middleware or someware?

    Is the instruction set of a CPU firmware and not middleware?

    Is there some middleware not firmware?

  2. What are the relations and differences between device drivers and
    firmware and middleware?

Thanks!

Best Answer

Firmware and Middleware are simple industry terms to describe a certain set of 'some code'.

Firmware (as wiki states) 'usually' represents software 'usually' written in assembly or C that 'usually' runs on/the hardware.

The 'on/the' is to indicate that this software resides on a permanent storage medium (like some sort of small flash) that is directly connected to the hardware the software is to control. It's called 'firmware' because it is software specifically designed to run the hardware.

I also quote the word usually because the tech industry has a horrible habit of coining terms and then warping them so that no one can know what the true intention of the word is. 'Embedded programming' is a good current example; while the term typically referred to programmers who developed what is essentially firmware (i.e. low-level ASM/C hardware developers), the term has since morphed to include Android developers (i.e. Linux/kernel developers who can operate at both the Java and C level). I'm not bashing any sort of developer or development practice (I do a lot of those types of developing myself), merely pointing out that the tech industry likes to misuse words.

Middleware is another example of such a word; while I've yet to hear or see 'firmware' used for anything but hardware level code, I've seen middleware used on everything from firmware to .NET/Java. Middleware is a generic term that (as a developer) you usually can decipher from context what is intended as I've seen it misused too many times; so to answer you directly:

I still don't understand the differences in their roles, relative to hardware, high-level software, operating system, etc. Firmware is software (code turned to binary format) that resides on a certain piece of hardware and runs said hardware. Middleware can be used to mean an API/library that interacts with hardware (or another piece of software for that matter).

Is BIOS firmware not middleware? Depending on your view of this, it could be both. Technically the BIOS is firmware (it's software that is specifically used to run the hardware it's on, i.e. the motherboard), but if your intent is to interact directly with a piece of hardware in some fashion (as an OS would), the BIOS 'could' be middleware, as you don't have to 'write' your own BIOS and hardware routines and this is where the misuse of 'middleware' can come in, but in a classical since, no the BIOS is not middleware.

Is a bootloader for an OS a firmware, middleware or someware? A bootloader for an OS is a piece of code that resides between the BIOS (or other basic hardware subsystem) and the higher level systems (usually the OS) that tells the lower systems (i.e. BIOS) where the OS resides on the boot medium. Typically speaking, a bootloader usually sits on a specific location of a storage medium (like the first few hundred bytes or more) and the BIOS knows (thanks to industry standards) where to 'look' for a bootloader at which point the bootloader takes over to do what it was written to do (usually boot the OS).

A bootloader is not firmware but could technically reside in firmware and as far as it being 'middleware', that could be yes or no depending on 'your' view of what 'middleware' is/should be, though in the classical since of middleware, I would not consider a bootloader middleware as it doesn't provide me any easier context (unless I'm writing an OS).

Is the instruction set of a CPU firmware and not middleware? An instruction set of a CPU would be considered more of an application programming interface (API) (which 'could' be considered a form of middleware), it is not firmware as the CPU (the central processing unit itself) doesn't have anything 'to run'; the CPU instruction set is what the software gets 'compiled' to (assembly) that the CPU then 'understands' how to run.

Is there some middleware not firmware? Yes; just about any software framework you can think of (the .NET or Java libraries for example) could be considered a form of middleware as they give a programmer an 'easier' way to interact with various aspects of a computer. Using Java, for instance, you could open a file and write to it and have that code 'work' on any Java supported system. Since certain Java API's let you have a few lines of code that interact with files across disparate systems, it can be considered a form of 'middleware' since the developer doesn't have to write the code for each different system (Linux/Windows/Apple,etc) to interact with the filesystem of the hard drive and OS him/herself.

What are the relations and differences between device drivers and firmware and middleware? A device driver is a piece of software that sits at the OS level (usually as an 'installed' library) that tells the OS 'how' to interact with said device. For instance, when you install the latest video drivers, you are installing software that the OS 'uses' to communicate with the actual video card itself. The video card itself has firmware on it that knows how to interpret the information given it to by the OS (because of the driver) and does what it will with it (draw a window or game sprite for instance).

Device drivers could be considered middleware (again depending on your view of such) since it sits between the OS/hardware and anyone wanting to use the hardware through the OS.

Anecdotal: in my industry experiences, I have found 'middleware' to 'mean' 'web services' or something of the like (at least what the person using the term is meaning anyways), though I have also seen/heard it (mis)used in many job postings and interviews to mean a variety of things from API's and libraries (like Boost or Spring) to the C++ STL and even C# itself (the language itself, not .NET).

I hope that can help.

Related Question