Why timeout in TCP is not a predefined fixed value? I know there is a set value of 15 for a timeout value but I was asked why timeout in TCP is not a predefined fixed value which I couldn't find an explantion for.
the main reason for RTO to be variable is to avoid congestion collapse.
if the timer is set to a too shorter value, there is a danger that the sender starts retransmitting packets, that are still being in-flight, thus overloading the network with unnecessary packets (that may end up delivered twice). The Jackobson algorithm for calculating RTO is intended to achieve this.
unless you set an RTO to unreasonably high value, there is a danger of this happening. and if your RTO is unreasonably high, any flow that had lost a packet, especially at the end of the stream, where there are not enough ACKs for dupacks to trigger, might take forever to complete.
Also, Internet is extremely diverse. As of now, typical RTTs between network paths can vary by an order of magnitude. data center networks have extremely low (<<ms), normal paths in countries with good internet (~10ms), bad internet(~50-60ms), and satellite networks (i think about 200ms). It will be very hard to have a reasonable fixed value to accomodate all of then.
If I am running a high performance local area TCP network then I would want the timeout value to be low. On the other hand, if I am sending messages to a low performance, over loaded TCP server I would want the timeout value to be long because the server might not be able to get to my traffic right away.