Discuss whether the following operations are idempotent:

i) Pressing a lift (elevator) request button;

ii) Writing data to a file;

iii) Appending data to a file.

Is it a necessary condition for idempotence that the operation should not be associated with any state?

The operation to write data to a file can be defined (i) as in Unix where each write is applied at the read-write pointer, in which case the operation is not idempotent; or (ii) as in several file servers where the write operation is applied to a specified sequence of locations, in which case, the operation is idempotent because it can be repeated any number of times with the same effect. The operation to append data to a file is not idempotent, because the file is extended each time this operation is performed.

The question of the relationship between idempotence and server state requires some careful clarification. It is a necessary condition of idempotence that the effect of an operation is independent of previous operations. Effects can be conveyed from one operation to the next by means of a server state such as a read-write pointer or a bank balance. Therefore it is a necessary condition of idempotence that the effects of an operation should not depend on server state. Note however, that the idempotent file write operation does change the state of a file.

Computer Science & Information Technology

You might also like to view...

Taskbar ________ provide one-click access to frequently used programs, folders, and features

Fill in the blank(s) with correct word

Computer Science & Information Technology

If class A inherits the properties, methods, and events of class B, then class A is referred to as a _ class of class B.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology