views:

1175

answers:

8

While I understand what Simulation and Emulation mean in general, I ,almost always, get confused about them. Assume that I create a piece of software that mimics an existing hardware/software, what should I call it? a Simulator or an Emulator?

Could anyone explain the difference in terms of programming?
Bonus: What is the difference in English between these two terms? (Sorry, I am not a native speaker :)

+1  A: 

In more or less normal parlance: If your software can do everything the mimicked system can do, it's an emulator. If it only approximates the results of a system (IT or otherwise), it's a simulator.

Pontus Gagge
A: 

This question is probably best answered by taking a look at historical practice.

In the past, I've seen gaming console emulators on PC for the PlayStation & SEGA.

Simulators are commonplace when referring to software that tries to mimic real life actions, such as driving or flying. Gran Turismo and Microsoft Flight Simulator spring to mind as classic examples of simulators.

As for the linguistic difference, emulation usually refers to the action of copying someone's (or something's) praiseworthy characteristics or behaviors. Emulation is distinct from imitation, in which a person is copied for the purpose of mockery.

The linguistic meaning of the verb 'simulation' is essentially to pretend or mimic someone or something.

Zaid
+12  A: 

An emulator can replace the original for 'real' use. A simulator is a model for analysis.

A Virtual PC emulates a PC.

If a flight-simulator could take you from A to B it would be an emulator.

Henk Holterman
@Henk Your "cockpit" example is fantastic though I understood it after I read Toybuilder answer. Thanks :)
AraK
Virtual PC *does not* emulate, it virtualizes. QEmu, on the other hand, *does* emulate. In both cases, the name should be a hint.
Jörg W Mittag
Jörg, that would lead to the next question: the difference between virtualizing and emulation (-: But you are right, I cut a few corners. VPC/VMWare _do_ emulate some hardware parts though (and share/virtualize other parts).
Henk Holterman
I think it would be safe to say that Virtual PC emulates a PC. HOW it emulates the PC is through virtualisation, but that's more of an implementation detail. You might argue that hardware virtualisation is a superset of emulation, in that can provide accelerated CPU support, exclusive hardware device access, etc.
Lee B
+5  A: 

An emulator is a model of a system which will accept any valid input that that the emulated system would accept, and produce the same output or result. So your software is an emulator, only if it reproduces the behavior of the emulated system precisely.

cdiggins
Thanks. I think this is a very precise definition of Emulation. So, for example Wine is a simulator because it doesn't necessarily give the same *precise* output defined in Windows?
AraK
Be careful about trying to shoehorn WINE into an either/or of emulator or simulator. WINE is a compatibility layer, which makes binaries from one system run on the binary API layer of another system. You might call it an adaptor. I suppose simulator isn't a bad way to understand it either, but it's not really much closer than emulator.
Lee B
+12  A: 

Emulation is the process of mimicing the outwardly observable behavior to match an existing target. The internal state of the emulation mechanism does not have to accurately reflect the internal state of the target which it is emulating.

Simulation, on the other hand, involves modeling the underlying state of the target. The end result of a good simulation is that the simulation model will emulate the target which it is simulating.

Ideally, you should be able to look into the simulation and observe properties that you would also see if you looked into the original target. In practice, there may some shortcuts to the simulation for performance reasons -- that is, some internal aspects of the simulation may actually be an emulation.

MAME is an arcade game emulator; Hyperterm is a (not very good) terminal emulator. There's no need to model the arcade machine or a terminal in detail to get the desired emulated behavior.

Flight Simulator is a simulator; SPICE is an electronics simulator. They model as much as possible every detail of the target to represent what the target does in reality.

EDIT: Other responses have pointed out that the goal of an emulation is to able to substitute for the object it is emulating. That's an important point. A simulation's focus is more on the modelling of the internal state of the target -- and the simulation does not necessarily lead to emulation. In particular, a simulation may run far slower than real time. SPICE, for example, cannot substitue for an actual electronics circuit (even if assuming there was some kind of magical device that perfectly interfaces electrical circuits to a SPICE simulation.) A simulation Simulation does not always lead to emulation --

Toybuilder
mmm... I think I am going to accept this answer :)
AraK
By this definition, is it therefore impossible to *simulate* the real world in software? I don't think we can accurately represent the underlying state of the real world - only emulate observable properties... for now.
Dolph
+5  A: 

It's a difference in focus. Emulators1 focus on recreating the behavior of a system, with no regard for how the system functions internally. Simulators2 focus on modeling the components of a system. You use an emulator when you care mostly about what a system does, and a simulator when you care about how it does it.

As for their general English meanings, emulation is "the endeavor to equal or to excel another in qualities or actions", while simulation is "to model, replicate, duplicate the behavior, appearance or properties of". Not much difference. Emulation comes from æmulus, "striving, rivaling," and is related to "imitate" and "image," which suggests a surface-lever resemblance. "Simulation" comes from similis "like", as does the word "similar," which perhaps suggests a deeper congruence.

References:

  1. Wikipedia: Emulator
  2. Wikipedia: Computer Simulation
  3. Wiktionary: emulation
  4. Wiktionary: simulation
  5. Etymology Online: emulation
  6. Etymology Online: simulation
outis
+2  A: 

Some years ago I came up with a very short adage that, I believe, captures the essence of the difference quite nicely:

A simulator is an emulator on a mission.

By that I mean that you use an emulator when you can't use the real thing, and you use a simulator when you can't use the real thing and you want to find something out about it.

Jörg W Mittag
+1  A: 

The distintion between the two terms is a bit fuzzy. Coming from a world where "Emulators" are pieces of hardware that allow you debug embedded systems. And remember products that allowed you to have ICE (In Circuit Emulation) capabilities to debug a PC platform, I find the use of the term "Emulation" to be a somewhat of a misnomer for software that SIMULATES the behaviour of a piece of hardware.

My justification for the current use of the term is Emulation is that it may "augment" the functionality, and only is concerned with a "reasonable" approximation of the behaviour of the system.

ICE: (In Circuit Emulation) A piece of hardware that is plugged into a board in place of the actual processor. It allows you to run the system as if the actual processor was present. Typically these have a variant of the processor on them to actually execute the software with glue logic to allow the user to break executation and single step under hardware control. Some would also provide logging capability. Most modern processors development systems have replace ICE type emulation with JTAG Emulation, where the JTAG just talks to the processor via a special purpose serial link and all execution is perform by the processor mounted on the board.

Software EMULATOR: An 0x86 emulator is only concerned with being able to execute 0x86 assembly language, not providing accurate cycle per cycle behaviourial model of a SPECIFIC 0x86 processor. Bochs is an example of this. QEMU does this, but also allows "virtualization" using special kernel modules.

SIMULATOR: Texas Instruments provides a CYCLE ACCURATE behaviourial model of there processors for software development that is intended to be a accurate SIMULATION of SPECIFIC processor cores behavior for the developers to use prior to having working hardware.

Software EMULATOR augmenting functionality: BLEEM not only allowed you to run Playstation Software, but also allowed the display to be output with higher resolution than the Playstation was able to provide, and also took advantage of more advanced capabilities of GPUs that were avaliable. (i.e. Better blending and smoothing of textures.)

NoMoreZealots