# Generalized foreground-background in Scheduling

Prerequisite – Foreground-Background Scheduling**Generalized foreground-background** in Scheduling, also known as **Least Attained Services** **(LAS)** is scheduling policy, mostly used in systems where size estimates are not available. It guesses remaining service time of job based on service received so far. If there are n such jobs, then they are served simultaneously, i.e., each of them is served at rate 1/n.

**Generalized foreground-background** gives service to job in system that has received least amount of service. In the event of ties, jobs having received least service share processor in processor sharing mode. A newly arriving job always preempts job currently in service and retains processor until it departs, or until next arrival occurs, or until it has obtained an amount of service equal to that received by job preempted on arrival, whichever occurs first.

**Working of Foreground-Background :**

A job enters first (or highest priority) state upon arrival in queue. The priority of jobs depends on their arrival time to that particular state in First Come First Serve manner. Jobs are served one at a time without interruption for time period of length q. After, server has completed job’s service request in certain state, job from highest (non-empty) priority state is selected for service. If job does not leave queue during its time in k_{th} state, it moves to state k + 1, which has lower priority, and waits until it is served in that state. In the n_{th} and final state, jobs are served only if there are no jobs in other states. In that final state, they are served until they leave system.

**Theorems under Generalized Foreground-Background (FB) :**

**Notations :**

**p**: refers to policy**X**: Service requirement with mean E[X] and variance var(X)**SRPT**: Shortest Remaining Processing Time**LAS**: Another representation for FB**E[Tl]**: E[T_{LAS}]**E[Ts]**: E[T_{SPRT}]

**Theorem-1:**

This deterministic distribution constitutes worst case where upper bound on mean response time of FB is attained, while number of distributions lead to lower bound. When load reaches 1, mean response time grows to infinity.

**Theorem-2:**

When p > 1, all jobs of size x < x_{p}, such that p_{Xp} = 1 have finite response under FB.

This theorem sets parameter for ensuring fairness in scheduling . Metric used to evaluate fairness is mean conditional slowdown E[S(x)]. A policy is said to be fair if its mean conditional slowdown for all job sizes is smaller than corresponding metric under PS (Processor – Sharing). However, when flow size distribution has finite second moment, some large jobs (though not largest job) always experience slowdown greater under FB.

**Theorem-3:**

For all job sizes x and at load p<1

This theorem depicts relation between mean condition response time of SRPT and FB.

**Characteristics of Generalized Foreground – Background :**

- LAS gives buffer space priority to first TCP packets of each flow, which means that these packets should not experience any loss.
- A new TCP flow starts in what is known as “slow start”, where its congestion window is initialized to very small value and then doubled after every round of transmission. Since, under FB, first packets of flow will experience no or negligible queuing delay, duration of round will be shorter under FB and congestion window will increase faster.
- The behavior of FB router is similar to that of FB queue, as long as packet to be serviced next arrives at router before the time instant, where it is selected by scheduler.
- FB can be modified to obtain threshold value for TCP packets, where service priority assigned to any packet cannot take value larger than threshold.
- FB minimizes/maximizes queue-length distribution under DFR/IFR distributions, and thus also mean queue length EQ and mean response time EV.
- For deterministic service distributions, FB has mean response times that are as large as possible under any work conserving policy
- For Light-tailed service distributions, FB has tail behavior that matches heaviest tail possible under work conserving policies.

## Please

Loginto comment...