A apresentação está carregando. Por favor, espere

A apresentação está carregando. Por favor, espere

INE5408 Estruturas de Dados Aula 6b Listas Circulares.

Apresentações semelhantes


Apresentação em tema: "INE5408 Estruturas de Dados Aula 6b Listas Circulares."— Transcrição da apresentação:

1 INE5408 Estruturas de Dados Aula 6b Listas Circulares

2 Listas Encadeadas Circulares Último elemento conecta ao primeiro. Implementação mais simples: 3 info próximo info próximo info próximo nrodados melão doce caro maçã azeda cara uva irkh barata

3 Listas Encadeadas Circulares Caso especial: –Lista circular unitária. Atividade: –Quais operações têm algoritmos diferentes? –Qual é a posição mais indicada para inserir quando a posição não importa ? 1 info próximo nrodados melão doce caro

4 Listas Encadeadas Circulares Alternativa para evitar mudança nos algoritmos –nodo-sentinela funciona sempre como nodo sem informações atachado à cabeça de lista –lista é criada posuindo o nodo sentinela –algoritmos não se modificam 4 info próximo info próximo info nrodados maçã azeda cara uva irkh barata melão doce caro próximo info próximo

5 Para que servem listas circulares? Modelagem e planejamento de rotas circulares –Caminho de retorno é diferente do de ida. –Exemplo: rotas aéreas tipo volta-ao-mundo. –Útil em sistemas de planejamento de itinerário e de reserva global de passagens como Amadeus Global Travel Distribution System

6 Para que servem listas circulares?

7

8 Escalonamento de Processos (Process Scheduling) em kernels de sistemas operacionais multitarefa preemptivos. –Exemplo: método round-robin (tradução: sabiá-cíclico - não se preocupe: ninguém usa) de escalonamento de processos com fatia de tempo constante por processo.

9 Round Robin CPU Proc.#1 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 Proc.#2 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 Proc.#3 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 Proc.#4 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5

10 Round Robin CPU Proc.#1 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 Proc.#2 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 Proc.#3 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 Proc.#4 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5

11 Round Robin CPU Proc.#1 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 Proc.#2 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 Proc.#3 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 Proc.#4 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5 long int SomeFunction(); /* int OtherFunction(); */ /* int */ CallingFunction() { long int test1; register /* int */ test2; test1 = SomeFunction(); if (test1 > 0) test2 = 0; else test2 = OtherFunction(); return test2; }. Var1 Var2 Var3 Var4 Var5

12 Para que servem listas circulares? Sistemas de impressão que controlam várias impressoras –Realizam escalonamento de impressoras (round-robin printing queue) por disponibilidade para impressão de documentos em uma fila de impressão cíclica única para várias impressoras.

13 Para que servem listas circulares?


Carregar ppt "INE5408 Estruturas de Dados Aula 6b Listas Circulares."

Apresentações semelhantes


Anúncios Google