diff options
-rw-r--r-- | answer_sheet/main.pdf | bin | 0 -> 141549 bytes | |||
-rw-r--r-- | answer_sheet/main.tex | 50 | ||||
-rw-r--r-- | answer_sheet/q1_1.dia | bin | 0 -> 1604 bytes | |||
-rw-r--r-- | answer_sheet/q1_1.png | bin | 0 -> 6095 bytes | |||
-rw-r--r-- | answer_sheet/q1_2.png | bin | 0 -> 5486 bytes | |||
-rw-r--r-- | answer_sheet/q1_3.png | bin | 0 -> 5131 bytes | |||
-rw-r--r-- | answer_sheet/structure.tex | 1 |
7 files changed, 51 insertions, 0 deletions
diff --git a/answer_sheet/main.pdf b/answer_sheet/main.pdf new file mode 100644 index 0000000..26316cd --- /dev/null +++ b/answer_sheet/main.pdf | |||
Binary files differ | |||
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} |
diff --git a/answer_sheet/q1_1.dia b/answer_sheet/q1_1.dia new file mode 100644 index 0000000..8581469 --- /dev/null +++ b/answer_sheet/q1_1.dia | |||
Binary files differ | |||
diff --git a/answer_sheet/q1_1.png b/answer_sheet/q1_1.png new file mode 100644 index 0000000..113a872 --- /dev/null +++ b/answer_sheet/q1_1.png | |||
Binary files differ | |||
diff --git a/answer_sheet/q1_2.png b/answer_sheet/q1_2.png new file mode 100644 index 0000000..6e420d0 --- /dev/null +++ b/answer_sheet/q1_2.png | |||
Binary files differ | |||
diff --git a/answer_sheet/q1_3.png b/answer_sheet/q1_3.png new file mode 100644 index 0000000..a07fffa --- /dev/null +++ b/answer_sheet/q1_3.png | |||
Binary files differ | |||
diff --git a/answer_sheet/structure.tex b/answer_sheet/structure.tex index 9b7b1f9..77d3e4c 100644 --- a/answer_sheet/structure.tex +++ b/answer_sheet/structure.tex | |||
@@ -33,6 +33,7 @@ | |||
33 | \usepackage[super]{nth} | 33 | \usepackage[super]{nth} |
34 | \usepackage{caption} | 34 | \usepackage{caption} |
35 | \usepackage{tikz} | 35 | \usepackage{tikz} |
36 | \usepackage{subcaption} | ||
36 | \usetikzlibrary{arrows,fit,positioning} | 37 | \usetikzlibrary{arrows,fit,positioning} |
37 | \usepackage[style=authoryear]{biblatex} | 38 | \usepackage[style=authoryear]{biblatex} |
38 | 39 | ||