12. Optimized W
Feb 22, 2021
Algorithm W: Block Step (cont.)
Recall block step:
1 2 3 4 5 |
|
\(W = 1 \cdot \sum P (T)\)
Cost of block = \(\Theta(\lg N + \lg P)\)
\(\sum P(t) = B_1 + B_{2a} + B_{2b}\), where for \(B_1\), \(u_j \leq P_j\).
\(B_{2a} = U_j < P_j\) and \(U_{j+1} \leq \frac{U_j}{\lg N/\lg \lg N}\). - This can happen at most \(k = O(\frac{\lg N}{\lg \lg N})\) → \(O(P \frac{\lg N}{\lg \lg N})\) times.
\(B_{2b} = U_j < P_j\) and \(U_{j+1} > \frac{U_j}{\lg N/\lg \lg N}\) (massive failures). - This can happen at most \(O(P \frac{\lg N}{\lg \lg N})\) times.
Per task / number of tasks:
Work in iteration: (*) from here
Crashes:
Sum of crashes \(j < P\):
Solve for \(k\)
Solve cost of case \(B_{2B}\) (*) use here
Total cost of cases:
\(P \leq N\), Cost of blocks: \(\Theta(\lg N + \lg P) = \Theta(\lg N)\).
Work is \(W = Cost_{BC} \times\) num_blocks
→ the dominant term is \(P(\frac{\lg^2N}{\lg \lg N})\) and \(T_1^* = \Theta(N)\); this is not optimal, but it is polylog efficient.
Cost of block step:
Optimized Algorithm W
If there was an oracle:
Lower bound:
Now modify step 3: do work → instead of 1 task, do \(lg N\) tasks:
\(Cost_{BS} = \Theta(\lg P + \lg N + \lg N + \lg N)\)
\(P \leq N\). For which P is this optimal? Substitute \(P = \frac{N}{\lg N}\):
\(W = O(N \lg N + P (\frac{\lg^2N}{\lg \lg N})))\) then \(W = O(N \lg N)\).
\(H = \frac{N}{\lg N}\), \(B_H = O(H + P\frac{\lg H}{\lg \lg H})\)
\(Cost_{BS} = \Theta(\lg P + \lg H + \lg N + \lg H) = \Theta(\lg N)\)
Needed when estimating work:
\(lg H= \lg N \cdot \lg \lg N = \Theta(\lg N)\)
\(\lg \lg H = \Theta(\lg lg N)\)
Work:
\(Work = B_H \cdot C_{BS} = O(H \lg N + P\frac{\lg H \lg N}{\lg \lg H}) = O(N + P \frac{\lg^2N}{\lg \lg N})\)
Optimal when \(P \leq \frac{N}{\frac{\lg^2 N}{\lg \lg N}}\)
Source routing
If you have PID = 5, how to find leaf?
Convert it to binary, \(5 = 101\) then use the binary to navigate from root to leaf:
1 - Go right
0 - Go left
1 - Go right
101 = RLR. This only works for 0-based indices.