Mmthrashc

void grab_swap_token(void) {

int current_interval; global_faults++;

current_interval = global_faults - current->mm->faultstamp;

/* First come first served */ if (swap_token_mm == NULL) {

current->mm->token_priority = current->mm->token_priority + 2; swap_token_mm = current->mm; goto out;

If the swap token is not assigned to any process yet, it can be grabbed without problems. Jumping to the label out will just update the settings for faultstamp and last_interval as you will see below.

Naturally, things are slightly more involved if the swap token is currently held by some process. In this case, the kernel has to decide if the new process should preempt the old one:

Continue reading here: Mmthrashc

Was this article helpful?

0 0