Mmthrashc

if (current_interval < current->mm->last_interval) current->mm->token_priority++;

if (likely(current->mm->token_priority > 0)) current->mm->token_priority-- ;

/* Check if we deserve the token */ if (current->mm->token_priority >

swap_token_mm->token_priority) { current->mm->token_priority += 2; swap_token_mm = current->mm;

/* Token holder came in again! */ current->mm->token_priority += 2;

Consider the simple case first: If the process requesting the swap token already has the token (the second else branch), this means that it swaps in a lot of pages. Accordingly, the token priority is increased because it is badly required.

If a different process holds the token, then the current task's token priority is increased if it has been waiting longer for the token than the holder had to, or decreased otherwise. Should the current token priority exceed the priority of the holder, then the token is taken from the holder and given to the requesting process.

Finally, the token time stamps of the current process need to be updated:

Continue reading here: Mmthrashc

Was this article helpful?

0 0