Question

I came to interesting theoretical problem:

Let's assume we have Program A and Program B connected via some IPC like tcp socket or named pipe. Program A sends some data to Program B and depending on success of data delivery both A and B do some operations. However B should do its operation only if it is sure that A has got the delivery confirmation. So we came up to 3 connections: A -> B [data tranfer] B -> A [delivery confirmation] A -> B [confirmation of getting delivery confirmation]

It may look weird but the goal is to don't do any operation neither on A nor B until both sides know that data has been transfered.

And here is the problem because second connection is for confirmation of success of first. And third is for confirmation of second but in fact there is no guarantee that connection 2 and 3 not fail and in that case we fall into infinite loop of confirmation. Is there some CS theory which solve that problem?

Was it helpful?

Solution

If I read your question right, the problem is called "the two general's problem". The gist of the issue is that the last entity that sends either a message or an acknowledgement knows nothing about the status of what it just sent, and so on.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top