- 79 Views
- Uploaded on
- Presentation posted in: General

Online Job Scheduling

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Online Job Scheduling

Marek Chrobak

University of California, Riverside

1

- Outline:
- Online optimization problems
- Competitive analysis
- Example: caching
2. List scheduling for minimum makesnan

- Graham’s algorithm is 2-competitive
3. List scheduling for related machines

4. Minimizing total completion time

- Optimal algorithm for the preemptive case
- 2-competitive algorithm for the non-preemptive case
5. Scheduling of unit jobs for maximum throughput

- 2-competitive greedy algorithm
- 1.618-competitive algorithm for the 2-bounded case
- Randomized 1.58-competitive algorithm
6. Scheduling equal-length jobs for maximum throughput

2

RAM

disk

k

CPU

- Paging:
- 2-Level memory system with large disk and k pages in RAM
- Sequence of requests to pages
- If the requested page is not in RAM (miss), it must be fetched from disk (another page may need to be evicted)
- Objective: minimize the number of misses

3

4

4

4

5

5

5

3

3

3

3

3

3

2

2

2

2

2

1

4

6

6

7

7

7

7

4

1

3

9

9

9

6

6

3

5

2

6

6

1

1

- Paging example:
- k= 5
- Initial RAM state: 4 3 5 6 1

6

1

2

3

9

7

5

Requests:

- Questions:
- Can we reduce the number of misses?

Yes

No

- Can we reduce it to zero?

4

4

2

4

2

2

2

5

3

3

5

3

5

1

1

5

1

1

5

7

6

6

7

6

6

- Main question: What page to evict on a miss?
- Common replacement strategies:
- LRU = least recently used
- FIFO = first-in first-out

LRU Example:

Requests:

…4 5 3 6

2

1

5

7

4

5

online

offline

usually b=0

Performance measure?

Algorithm A is R-competitive if for any sequence S of page

requests

(# of misses of A on S) ≤ R·(minimum # of misses on S) + b

where C is a constant independent of S

Competitive ratio of A = smallest such R

6

4

4

4

4

4

4

4

4

1

1

3

1

2

1

1

1

5

5

5

5

9

9

7

9

6

6

6

6

6

6

6

6

How to determine optimum?

Belady Algorithm: at each step evict the page whose next request is farthest in the future.

…4 5 3 6

2

1

5

7

9

1

4

6

5

3

7

7

LRU:

3

3

2

2

2

1

1

1

2

3

1

3

3

2

1

3

1

2

3

2

2

2

1

1

3

1

3

1

1

1

1

3

2

3

3

2

1 2

3

1

2

3

1

3

1

2

2

Optimum:

How bad is LRU?

Try k=2

each request

is a miss

every second

request is a miss

So competitive ratio of LRU is ≥ 2

8

misses of LRU

Requests: … x y … r z r… p r p … s p s … r’ … p’ … s’

optimum must

have r in cache

phase = request

until the 2nd miss

In this phase: at least 2 different requests other than r, so optimum must miss at least once

How good is LRU?

Try k=2 again

We have p r and s p

Case 1: s r. Then r,p,s are different

Case 2: s = r. So on p we evicted r. There must

be another request z r,p between r, p

for otherwise LRU would not evict r

So competitive ratio of LRU is ≤ 2

Exercise: Show that the competitive ratio of LRU for k pages is ≤ k.

Hint: Similar idea. If all faults in a phase different, you are done. Else, consider two equal faults…

9

k requests

Q

B = Belady’s

pages in

memory

So at most one fault here

Is it possible to improve ratio k?

Theorem: No online paging algorithm has competitive

ratio smaller than k.

Proof: A = some online algorithm.

Adversary strategy: fix a set of pages 1,2,…,k+1. At each step request the page that A does not have in memory.

- Then:
- Algorithm A faults at each time step
- Belady faults at most once in each k consecutive steps (why?)

Then B and Q differ by at most 1

Therefore the competitive ratio of A is at least k

10