In such questions in general, we calculate speed-up using the following formula:
$\begin{align*} &S = \left [ {\color{red}{\left ( 1-\sum F_i \right )}} + {\color{blue}{\left ( \sum \frac{F_i}{S_i} \right )}} \right ]^{-1} \\ \\ \hline \\ &\text{Where}\\ &F_i = \text{fraction of a hardware component uses} \\ &S_i = \text{speedup of the respective hardware component in the new design} \\ \end{align*}$
For example in a system having a lot of components of and many of them need improvement or speedup. Suppose out of all components,ony $A$ , $B$ and $C$ units are upgraded and their individual speedups are $x$ , $y$ and $z$.Assume fraction of uses of $A$,$B$ and $C$ in the system are $0.1$, $0.3$, $0.2$ respectively.
Then
$\begin{align*} &S = \left [ {\color{red}{\left ( 1-0.1-0.2-0.3 \right )}} + {\color{blue}{\left ( \frac{0.1}{x} +\frac{0.3}{y} + \frac{0.2}{z} \right )}} \right ]^{-1} \\ \end{align*}$
( note that $0.1+0.3+0.2 \neq 1$ , other units are also there in the system )
Now in the question of this post,
We have only two hardware units. So, $1-\sum F_i$ term cancels out.
- Floating point unit
- Fixed point unit
Ratio of
No of floating point
operations
:
No of Fixed point
operatios
= $6 : 4$
and one floating point operation takes $k$ times more time than one fixed point operation.
Then ratio of
uses of floating point unit
:
uses of fixed point unit
= $6k : 4$.
Now we can choose the constant of proportionality (say ${\color{red}{m}} > 0$) in the above ratio in such a way that $6k{\color{red}{m}}+4{\color{red}{m}} = 1$.
These manipulation gives us the fraction of uses $\color{maroon}{F_i}$ .
- $\large\color{maroon}{F_1}$ = $\begin{align*} \frac{k.6}{k.6+4} \end{align*}$
- $\large\color{maroon}{F_2}$ = $\begin{align*} \frac{4}{k.6+4} \end{align*}$
Respective speed-ups are
- $S_1$ = $\color{maroon}{1+a}$ for Floating point unit where a is the % increse in speed
- $S_2$ = $\color{maroon}{1+b}$ for fixed point unit where b is the % increse in speed
So,
$\begin{align*} &S = \left [ {\color{red}{\left ( 1-\frac{6k}{6k+4} - \frac{4}{6k+4} \right )}} + {\color{blue}{\left ( \frac{\frac{6k}{6k+4}}{1+a} + \frac{\frac{4}{6k+4}}{1+b} \right )}} \right ]^{-1} \\ &S = \left [ {\color{blue}{\left ( \frac{6k}{(1+a)(6k+4)} + \frac{4}{(1+b)(6k+4)} \right )}} \right ]^{-1} \\ \\ &\text{Given} \quad k =2 \text{ and } \quad a = 0.3 \quad b = 0.2\\ \\ &S = \left [ {\color{blue}{\left ( \frac{6*2}{(1+0.3)(6*2+4)} + \frac{4}{(1+0.2)(6*2+4)} \right )}} \right ]^{-1} \\ &S = {\large\color{blue}{1.273}} \\ \end{align*}$
We need not go through all these steps for such a question in the next time,
We can directly jump to last two lines and plug the values of the parameters and solve.