In: Computer Science
A program P1 sends its output to another program P2. Let R1 be the range of P1 and D2bethe domain of P2. Discuss with concrete examples, the implication that the range of P1 does not equal the domain of P2(i.e. R1 != D2 or R1 <> D2).What behaviors would you expect from P2 when it receives and processes the output from P1? Consider the different situations of this implication.
When one program output depends on the another program then it
comes under category of coupling precisely tightly coupling , As a
developer or Software Engineer one needs to avoid tightly coupled
codes the reason is it may leads to faults or wrong answers , the
basic thing you need to do is modularizing the code by decreasing
coupling of code .
In the above Scenario , P2 depends on the output of P1 , for an example let us consider the code of P1 is struck with some issue then P2 wont complete its process and it would be waiting for the completion of P1 process which leads to waste of resource management and code breakage .
Also when one implements multi threading in P1 then the process P1 may run into false outputs , if one doesn't clearly uses synchronization and uses lock and key process . In many code areas values get assigned before updation if there is no synchronization block . So one should take care of threading in use of process dependent code or tightly coupled
It Increases Latency , CPU resources gets wasted , in broader view for process P2 to execute it waits for P1 which will take some time to execute and then P2 will execute . If they would not have been code dependent then parallel code execution would have possible which leads to decrease in latency and code cpu resources would have effiicently used
Major Problem Would be latency What if Process P1 runs into infinte loop !!! then theroretically P2 to execute it takes infinite time !! but compiler stops after 10s if the loop goes infinite in condition .