CrazyEngineers Archive
Old, but evergreen and popular discussions on CrazyEngineers, presented to you in read-only mode.
@Ankita Katdare • 10 May, 2011
While studying Transport Layer's 'releasing a connection' topic, I came across the famous 'Two Army Problem'

Imagine that one army (say white army) is encamped in a valley. On both the surrounding hill sides is opposite army (say blue army). The white army is larger than either of the blue armies alone, but together they are larger than the white army.
If either blue army attacks by itself , it will be defeated but if the blue armies attack simultaneously, they will be victorious.

The blue armies want to synchronize their attacks. However, their only communication medium is to send messages on foot down into the valley, where they might be captured and the message is lost.
The question is: Does a protocol exist that allows the blue armies to win?

It's been proven that no such protocol exists that works. Any ideas?
@PraveenKumar Purushothaman • 14 May, 2011 Couldn't understand this part!
If either blue army attacks by itself , it will be defeated but if the blue armies attack simultaneously, they will be victorious.
But in case of TCP Protocol, which lays in the Transport Layer, it should be synchronised in order to establish a communication right. So, the protocol is currently existing in TCP... What say?
@xheavenlyx • 14 May, 2011 If we look at it as a non-technical, real life challenge, then:

1. Smoke signals in Morse code.

2. Light signal using large reflectors made up of shields of 20 soldiers (god bless those guys...)

3. Fire at WILL!!
@MegaByte • 14 May, 2011
AbraKaDabra
If either blue army attacks by itself , it will be defeated but if the blue armies attack simultaneously, they will be victorious.

It should be:

If either of the blue army (any one of the blue army) attacks the white army, it will be defeated. But if both the blue armies attack simultaneously, they will be victorious.
@MegaByte • 14 May, 2011
I've read it somewhere that, in most of the protocols, there is the uncertainity of the last handshake message that is being sent. Thus, no protocol exists that allows proper communication in the Two Army problem.
@durga ch • 14 May, 2011 is there a solution to it?
If you do a netstat in your comp ( for windows), you can se variety of tcp connections , most of them will be in established state and few of them in transition states, incase the ack of ack is not recieved, the other party will never know their ack as recieved, thus never close the session. such connections will be in fin-wait mode
@PraveenKumar Purushothaman • 14 May, 2011
durga
is there a solution to it?
If you do a netstat in your comp ( for windows), you can se variety of tcp connections , most of them will be in established state and few of them in transition states, incase the ack of ack is not recieved, the other party will never know their ack as recieved, thus never close the session. such connections will be in fin-wait mode
They too have a limit. Acco. to the RFC of TCP connection, after a 60 second wait, it gets closed.
@vik001ind • 14 May, 2011
The blue armies want to synchronize their attacks. However, their only communication medium is to send messages on foot down into the valley, where they might be captured and the message is lost.
It's evident that there is no other form of communication other than sending a man.
let's assume left blue army is B1 & right one is B2. B1 sends a man(m1) to B2 & B2 sends a man (m2) back to B1 or vice versa for syncing the attack. The problem is that the man may be caught in the middle.
The winning probability depends on probability of both men not getting caught. Let's assume everyone in the blue army has the same probability of not getting caught ie. p[n], which is highly unlikely in real senario. Therefore winning probability depends on p[n]*p[n].

Their stategy should be to keep sending men till their strength is greater than white army & hope someone will reach back to them from B2. This is important because there is a very high probability of lossing if they don't sync their attack.
If the blue army is not aware of the strength white army, they should still keep sending men as they gonna lose either way.

Another strategy could be of non acknowledgement type. B1 sends a few men & hopes atleast one will reach b2 & make them aware of the attack time. The number of men send by b1 depends on the p[n]. Suppose, p[n]=1/5, then b1 should send atleast 5, but still it's possible that all of them are caught. For this strategy to work, blue army should know their p[n].

Blue army must stick to a stategy as there is very very high probability that they will lose if they don't follow any strategy.

That's all I can make out of this problem. 😀
@durga ch • 14 May, 2011
praveenscience
They too have a limit. Acco. to the RFC of TCP connection, after a 60 second wait, it gets closed.
yes,, so timeout i think can be considered as amitigation effort when we want to close the session, but incase A wants to start the session and the syc fails to reach B, and since B did not recieve any syc it wont ack and since B did not ack, A assumes it lost connection to B and doesnot do a syc -ack-ack. or am i getting this wrong?
but there is always that A can retry.

@ VIK: even i took time to understand that the above problem relates to TCP sessions, the problem statement kinda looks incomplete without the complete context.
4.9k views

Related Posts

@desalepraful · Jan 4, 2013

I'm looking for M.Tech level seminar on power system engineering. I'm currently a studen tof 1st year M.Tech (electrical engineering) student.
1.9k views

@Farjand · Mar 6, 2011

Friends can you imagine life without plastics? Well possibly no. Humans have invented plastics recently may be about 1800 A.D. Well so let us discuss the process of plastic molding....
2.3k views

@Ankita Katdare · Oct 4, 2013

Running a Google PageSpeed test for a wordpress site, may often land you up on a suggestion that says, Optimize CSS Delivery for certain URLs. This rule triggers when PageSpeed...
3.9k views

@Kaustubh Katdare · Mar 6, 2011

This thread is for all the freshers who've gotten offer letters from Tech Mahindra (TechM). Share your story and also tell us which center you're joining for the initial training....
4.4k views

@Ankita Katdare · Jun 2, 2013

1. To Engineer is Human Using graphic archive footage of the world's major civil disasters in To Engineer is Human, Horizon illustrates some of the great engineering failures of history...
7k views