The term itself has a wide range of applications. you could call a small microcontroller with flash program space measured in kilobytes or less, and a plunger measured in bits or bytes (not enough to be kbytes) as an embedded system. Similarly, tivo works with a full-blown operating system on a rather multi-module computer motherboard (replace tivo with xbox as another example) as an embedded system. Therefore, you need to be less vague about your question. virtual memory has little to do with the fact that its applications cross these boundaries.
There are many answers above, David S has the best, of course, that virtual memory simply means that the memory address on one side of the virtual memory boundary is different from the physical address that is used on the other side of this boundary. Where, how, why, etc. The border is changing.
A popular use for virtual memory, and I can argue that the main use case is for operating systems. One of the advantages is that, for example, all applications can be compiled for the same address space, all applications can be compiled so that, from the point of view of programs, they all start with address 0x8000, and how much this program was launched and turned to the memory to which he refers based on this address. The combination of hardware and operating system changes the virtual address that the program uses for the physical address. If the operating system allows multitasking, then each task may think that they are in the same address space, but the physical addresses are different for each of these tasks. I will not dwell on why using the proposed fixed address space is an advantage. Another aspect of using operating systems is memory management. However, many MMUs will allow you to segment memory. If the user wants to allocate 100 megabytes of memory, the program can access in its virtual address space equal to 100 megabytes, as if it were linear, and in this address space it is linear, but 100 megabytes can be divided into 4 thousand bytes, which scattered throughout the physical address space, are not always likely, but it is certainly technically possible that no two parts of this physical memory are located next to any other piece of 100 megabytes. your memory management does not have to try to keep the large physical chunks of memory available for distribution applications. Note that not all MMUs are exactly the same, and only 4 KB is an example. The third major benefit of virtual address space for the operating system is security. If an application is tied to a virtual address space, it is often easy to prevent the application from touching the memory of any other application or operating system. the application in this case will work / run at the verification level, so that all calls are considered virtual and must go through the translation to the physical, tables that are used to determine that the virtual to physical can contain security flags. If an application accesses a memory address in its virtual space to which it does not have access to business, the hardware may interfere with this and allow the operating system to take measures regarding how to handle it (virtualize some equipment, display an error message and kill the application, cause a warning, and not kill the application, but at the same time load the dummy application data for their transactions, etc.).
There are many ways this can be used in an embedded system. firstly, many embedded systems run operating systems, so all of the above, the simplicity of compiling a program for the address space, the relative ease of managing memory and protecting other applications and the operating system are other advantages that were not mentioned. (one of which is virtualization, the ability to enable / disable instruction / data caching based on blocks by blocks is another)
The bottom line is that David S. pointed out. Virtual memory simply means that the virtual address is not necessarily equal to the physical address, it can be, but not necessarily, some boundary, some hardware, usually managed by a table, which translates the virtual address to the physical address. There are many reasons why you would like to do this, because some embedded systems are indistinguishable from non-embedded systems, any reason that applies to a non-embedded system can be applied to an embedded system.
As far as people want you to think that a system has a flat address space, this is often an illusion. In a microcontroller, for example, you can have several flash banks and one or more storage banks. Each of these banks has a physical, usually zero, address. Even if there is no mmu or something similar, there is a place somewhere between the address bus of the processor and the address bus on the flash memory or RAM memory, which decodes the address on the processor and uses this to access a specific memory bank, Often the lower bits and the upper bits are responsible for choosing the bank (this often happens with mmu), so in this sense, the processor lives in a virtual address space. (not limited to microcontrollers, processors with bus addresses are usually processed). When using microcontrollers, depending on which pin is pulled high or low or some other mechanism, you may have a chip function that allows you to use one flash bank to load a processor or another. You can snap the input pin high, and the processors built into the bootloader allow you to access and debug the system, for example, reprogram the flash application. Or perhaps tie this line to a minimum and load the flash application, not the debugger / boot flash drive. some chips become even more complex, allowing you to load a single flash, then the program writes a register somewhere instantly changes the memory architecture, moving things around, for example, allows you to use ram for the interrupt vector table so that your application can change after loading, the vector table in a flash, which is not so easy to change at will.
Now, when you talk about virtual memory, like exchanging to and from disk, this is a trick that operating systems often use to create the illusion of having more bars. I mentioned above about the virtualization category. virtual memory in the sense that it is actually missing, I have X bytes, but let the software think that there are Y bytes (where Y is greater than X). The operating system, through virtual tables used by the hardware, controls which pieces of memory are tied to the physical board and is allowed to fill as provided by the equipment, or marked as inaccessible in any way, raising an exception for the operating system; during verification, the operating system determines that this is a valid address for this application, but the data behind this address has been replaced with a disk. Then, the operating system detects through another algorithm another piece of ram belonging to whom (part of the algorithm), and copies this fragment of ram to disk, marks the table associated with this virtual one as physical, and then copies the desired fragment from disk to ram, notes that chunk is valid and allows the machine to complete a memory cycle.
Nothing but to say how vmware or other virtual machines work. You can execute instructions initially on hardware using virtual memory as long as you raise an exception, the virtual machine might think that you have a xyz network interface and might have a driver that accesses the register in that xyz network interface, but the reality is you do not have xyz equipment and / or you do not want virtual machine applications to access this equipment, so you virtualized it, you delay access to the register and use software that Ichiro hardware that you forge, and provides virtual machine program continues. This is obviously not the only way to make virtual machines, but it is one way, if the hardware supports it, to allow the virtual machine to work very fast as a percentage of the time that the instructions on the hardware actually execute. The slowest way to virtualize, of course, is to virtualize everything, including the processor, each command in this case will be modeled, it is rather slow, but it has its own functions (system virtualization on x86 or x86 on hand, xyz on abc, fill in the blanks). And if this is the type of virtual memory that you are talking about in the embedded system, it’s good if the embedded system is for the most part indistinguishable from a non-embedded system (for example, xbox or tivo), then for the same reasons you can allow this. If you were on a microcontroller, then most likely the use cases would usually mean if you need more memory, you would buy a larger microcontroller or add more memory to the system or change the needs of the application, so it does not need so much memory, maybe there may be exceptions, but it mainly depends on your application and requirements, a common goal or a common goal, such as a system that allows applications or their data to be more than the available RAM, will require a kind of solution. the microcontroller in your keyless keychain or in your remote control for your TV or clock device or does not require any “applications” to require more resources than physically there.