Zero operation

from Wikipedia, the free encyclopedia

The zero operation ( English No Operation ; Assembler-Mnemonic: NOP or NOOP ) is an instruction - more precisely a processor instruction - in machine programs or communication protocols that does nothing.

Processor instruction

On a microprocessor , the execution of a NOP instruction does nothing, except increment the instruction counter and the time it takes to fetch this instruction from the working memory and to interpret it. The instruction opcode is between one and nine bytes long.

On x86-compatible processors , the original variant is the one-byte-long NOP instruction with the opcode 0x90 , which is an alias for XCHG (E) AX, (E) AX , i.e. H. the exchange of the register value with itself, and is implemented on all x86 processors. The multi-byte variant may not be supported by all processors.

The command is used to

  • establish a specific alignment in memory,
  • to "delete" existing commands in the direct machine code by overwriting them with NOP commands,
  • to bring about a time delay - usually only roughly predictable - (if necessary called several times in a loop ), for example to avoid errors caused by race conditions or to define the timing of an external signal,
  • Prevent pipeline hazards
  • to fill a branch delay slot or
  • as "filler material" for unused memory (e.g. BIOS, ROMs or embedded systems).
  • as "filler material" to achieve a better hit rate in the event of exploits through an overflow.

Command in communication protocols

A NOOP command is implemented in the following communication protocols . The server responds to the NOOP command with a status report . The command can thus be used, among other things, to check whether a connection still exists during phases of prolonged inactivity.

See also

  • IEFBR14 (as an example for an “empty” command on another level).

literature

Individual evidence

  1. RFC 2060