The Gateway to Computer Science Excellence
+20 votes
3k views

A program consists of two modules executed sequentially. Let $f_1(t)$ and $f_2(t)$ respectively denote the probability density functions of time taken to execute the two modules. The probability density function of the overall time taken to execute the program is given by 

  1. $f_1(t)+f_2(t)$

  2. $\int_0^t f_1(x)f_2(x)dx$

  3. $\int_0^t f_1(x)f_2(t-x)dx$

  4. $\max\{f_1(t),f_2(t)\}$

in Probability by Veteran (52.1k points) | 3k views

3 Answers

+20 votes
Best answer
We assume the total time to be $‘t’$ units and $f1$ executes for $‘x’$ units.

Since, $f1(t)$ and $f2(t)$ are executed sequentially.
So, $f2$ is executed for $‘t – x’$ units.

We apply convolution on the sum of two independent random variables to get probability density function of the overall time taken to execute the program.

$f1(x) $*$ f2(t – x)$

Correct Answer: $C$
by Active (4k points)
edited by
0

f1(t) * f2(t – x) ...  it should be f1(x) * f2(t – x)

Please correct it.

0

explain this line please

We apply convolution on the sum of two independent random variables to get probability density function of the overall time taken to execute the program.

 

0

@Pranabesh Ghosh 1 Can we think of it like this: Assuming module 1 gets implemented first at time t, it executes for f1(t) time units. Then at that point module 2 starts, so it will take f2(f1(t) + 1) time units, as module 1 finishes at f1(t) time step. So the final answer can be max(f1(t), f2(t)) as ultimately module 2 will finish at the highest time step.

+28 votes

$f_k(t)$ denote the probability density function of time taken to execute module (Here k = 1, 2). Means probability that module k will take 5 unit of time is given by $f_k(5)$.

Now let us assume total execution time is  4 unit then it's probability will be given by  -->

$f_1(0)*f_2(4)$ + $f_1(1)*f_2(3)$ + $f_1(2)*f_2(2)$ + $f_1(3)*f_2(1)$ + $f_1(4)*f_2(0)$

(means for example if first module takes 3 unit then another module should take 1 unit of time(and both probabilities are independent because module execution is sequential) so it's probability is $f_1(3)*f_2(1)$  ).

If entire program execution time is t unit then we can write general formula for it's probability as

  $f_{total}(t) = $$\int_{0}^{t}$ $ f_1(x)*f_2(t-x)$dx$ $

which is also telling probability density at point 't' or $f_{total}(t)$ is our desired probability density function for entire program execution.

Answer is (C) part.

by Boss (13.2k points)
edited by
+3

what will be the answer if the program modules execution is parallel not sequential???

0

But the question is asking about probability density function and (C) is the probability of the entire program execution. Probability density function must be just  f1(x)∗f2(t−x)  (without integration).

Can anyone please verify??

+8 votes

Solution: C

Since the two modules execute sequentially. The total runtime of the program is the sum of runtime of the the two modules. Probability mass function of sum of two random variable is given by the convolution in the option C.

REFERENCE

by Active (1.4k points)
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,651 questions
56,214 answers
194,175 comments
95,431 users