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?

What will be an ideal response?


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...

Why is a 64-bit architecture an improvement with computer processing? List three reasons.

What will be an ideal response?

Computer Science & Information Technology

You enter the text for a WordArt design in the Text pane

Indicate whether the statement is true or false

Computer Science & Information Technology

Which is an effective way to change a SUM of Price field in the VALUES area to an AVERAGE function?

A. Select the appropriate cell in the PivotTable and type =AVERAGE(Price). B. Click the AVERAGE button on the Analyze tab. C. Right click the appropriate cell and select AVERAGE from the mini-tool bar. D. Click the field's arrow in the VALUES area and select Value Field Settings.

Computer Science & Information Technology

You use a ____ statement within a try block to specify an error message.

A. catch B. call C. throw D. throws

Computer Science & Information Technology