diff options
Diffstat (limited to 'answer_sheet/main.tex')
-rw-r--r-- | answer_sheet/main.tex | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/answer_sheet/main.tex b/answer_sheet/main.tex index 2d423e5..f9cd5d4 100644 --- a/answer_sheet/main.tex +++ b/answer_sheet/main.tex | |||
@@ -11,4 +11,54 @@ | |||
11 | 11 | ||
12 | \maketitle | 12 | \maketitle |
13 | 13 | ||
14 | \section{Job Scheduling}% | ||
15 | \label{sec:job_scheduling} | ||
16 | |||
17 | First we will state the variables we will use. | ||
18 | A job $n_i \in n$ is split into preprocessing $p_i \in p$ and indexing $f_i \in f$ per the question text. | ||
19 | With the given question text, we will ignore any kind of utilisation or efficiency concerns. | ||
20 | In other words, we will not care about the number of PCs we employ nor the time they will stay idle. | ||
21 | So, every indexing job $f_i \in f$ will be run on a separate PC\@. | ||
22 | |||
23 | Since we cannot pipeline the preprocessing jobs $p_{i} \in p$, any kind of real choice we have will be done on the $f_i \in f$. | ||
24 | The trivial case is when the preprocessing jobs are the \enquote{bottleneck} of the system, where; | ||
25 | |||
26 | \begin{equation*} | ||
27 | \forall p_{i} \in p > \forall f_{i} \in f | ||
28 | \end{equation*} | ||
29 | |||
30 | The completion time in this case is minimized by sorting the $f_{i} \in f$ and placing the \emph{shortest} $f_{i}$ last. | ||
31 | |||
32 | \begin{figure}[htpb] | ||
33 | \centering | ||
34 | \includegraphics[width=0.5\linewidth]{q1_1} | ||
35 | \caption{The trivial case where preprocessing jobs are all longer than the indexing jobs}% | ||
36 | \label{fig:q1_1} | ||
37 | \end{figure} | ||
38 | |||
39 | This approach extends to the case where the preprocessing time can be shorter than the indexing time as well. | ||
40 | In the example given in Figure~\ref{fig:1_cases}, two preprocessing jobs $p_1$ and $p_2$ both take 1 unit of time. | ||
41 | Whereas, the indexing jobs tied to the preprocessing jobs $f_1$ and $f_2$ take 5 and 1 units of time, respectively. | ||
42 | By scheduling the preprocessing task that is tied to the longest indexing job $p_1$ first, we can finish the whole computation in 6 time units which takes 7 time units in the other case. | ||
43 | |||
44 | Formally, the algorithm we propose simply sorts the $f_i \in f$ in $\mathcal{O}(n\log(n))$ time and schedules the jobs with respect to $f_i \in f$ (so the $p_i \in p$ tied to $f_i \in f$) from longest to shortest. | ||
45 | |||
46 | \begin{figure} | ||
47 | \centering | ||
48 | \begin{subfigure}[b]{0.45\textwidth} | ||
49 | \includegraphics[width=\textwidth]{q1_2} | ||
50 | \caption{The longest task is scheduled first}% | ||
51 | \label{subfig:1_1} | ||
52 | \end{subfigure} | ||
53 | ~ | ||
54 | \begin{subfigure}[b]{0.45\textwidth} | ||
55 | \includegraphics[width=\textwidth]{q1_3} | ||
56 | \caption{The longest task is scheduled last}% | ||
57 | \label{subfig:1_2} | ||
58 | \end{subfigure} | ||
59 | \caption{The worked example of the cases}% | ||
60 | \label{fig:1_cases} | ||
61 | \end{figure} | ||
62 | |||
63 | |||
14 | \end{document} | 64 | \end{document} |