O GoConqr está de visual novo! Conte para nós o que você achou.

Notas

Livelock

Ahmad Abdelwahed Operating Systems 0 Inglês 1 página

Conteúdo das notas (1)

Página 1

In some situations, a process tries to be polite by giving up the locks it already acquired whenever it noticed that it cannot obtain the next lock it needs.

Then waits a millisecond, say, and tries again.

In principle, this is good and should help to detect and avoid deadlock.

However, if the other process does the same thing at exactly the same time, they will be in the situation of two people trying to pass each other on the street when both of them politely step aside, and yet no progress is possible, because they keep stepping the same way at the same time.

void process_A(void) {

acquire_lock(&resource_1);

while (try_lock(&resource_2) == FAIL) {

release_lock(&resource_1);

wait_fixed_time();

acquire_lock(&resource_1);

}

use_both_resources();

release_lock(&resource_2);

release_lock(&resource_1);

}

void process_B(void) {

acquire_lock(&resource_2);

while (try_lock(&resource_1) == FAIL) {

release_lock(&resource_2);

wait_fixed_time();

acquire_lock(&resource_2);

}

use_both_resources();

release_lock(&resource_1);

release_lock(&resource_2);

}

Informações

Descrição
0 Operating Systems (Deadlock) Notas sobre Livelock, criado por Ahmad Abdelwahed em 26-06-2015.
Visualizações
4
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?