13.04.2013 Views

Anderson Moreira - Site SIEP-PE - IFPE

Anderson Moreira - Site SIEP-PE - IFPE

Anderson Moreira - Site SIEP-PE - IFPE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Sistemas Operacionais – Aula 5<br />

<strong>Anderson</strong> L. S. <strong>Moreira</strong><br />

anderson.moreira@recife.ifpe.edu.br<br />

http://dase.ifpe.edu.br/~alsm<br />

Curso de Análise e Desenvolvimento<br />

de Sistemas de Informação<br />

Recife - <strong>PE</strong><br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5


O que fazer com essa apresentação<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5<br />

junho de 11


Créditos<br />

Professor: <strong>Anderson</strong> L. S. <strong>Moreira</strong><br />

Disciplina: Sistemas Operacionais<br />

Home-page:<br />

http://dase.ifpe.edu.br/~alsm<br />

Aula 5 mostra implementação de processos com o uso das<br />

estruturas de threads.<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5 3 de junho de 2011<br />

2/14


Agenda<br />

Introdução<br />

Ambiente monothread<br />

Ambiente multithread<br />

Arquitetura e implementação<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5 3 de junho de 2011


Ambiente Monothread<br />

Concorrência com processos<br />

Subprocessos Processos Independentes<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5 3 de junho de 2011


Ambiente Monothread<br />

Ambiente monothread<br />

Thread Thread<br />

Thread<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5 3 de junho de 2011


Ambiente Multithread<br />

Ambiente multithread<br />

Contexto de<br />

software<br />

Contexto<br />

de hardware<br />

Thread 1<br />

Contexto<br />

de hardware<br />

Thread 2<br />

Espaço de<br />

endereçamento<br />

Contexto<br />

de hardware<br />

Thread 3<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5 3 de junho de 2011


Ambiente Multithread<br />

Aplicação multithread<br />

Processo<br />

Espaço de<br />

endereçamento<br />

Programa Principal<br />

Call Sub_1<br />

Call Sub_2<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5 3 de junho de 2011<br />

Fim<br />

Sub_1<br />

Ret<br />

Sub_2<br />

Ret<br />

...<br />

Variáveis<br />

...<br />

Thread_1<br />

PC<br />

SP<br />

Thread_2<br />

PC<br />

SP<br />

Thread_3<br />

PC<br />

SP<br />

Contexto de<br />

Hardware<br />

Contexto de<br />

Hardware<br />

Contexto de<br />

Hardware


Ambiente Multithread<br />

Aplicação<br />

multithread (a)<br />

Thread de<br />

exibição<br />

Thread de<br />

entrada<br />

Thread de<br />

gravação<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5 3 de junho de 2011<br />

Buffer


Ambiente Multithread<br />

Aplicação<br />

multithread (b)<br />

Thread<br />

Processo servidor<br />

Solicitações<br />

Thread<br />

Thread<br />

Processo cliente Processo cliente Processo cliente<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5 3 de junho de 2011


Arquitetura e Implementação<br />

Threads em modo usuário<br />

Threads em modo kernel<br />

Threads em modo híbrido<br />

Ativação do escalonador<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5 3 de junho de 2011


Arquitetura e Implementação<br />

Threads em modo usuário<br />

Thread 0<br />

Thread 1<br />

Thread 2<br />

Biblioteca<br />

Kernel<br />

Modo<br />

usuário<br />

Modo<br />

kernel<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5 3 de junho de 2011<br />

Thread 3<br />

Thread 4


Arquitetura e Implementação<br />

Threads em modo kernel<br />

Thread 0<br />

Thread 1<br />

Thread 2<br />

Kernel<br />

Modo<br />

usuário<br />

Modo<br />

kernel<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5 3 de junho de 2011<br />

Thread 3<br />

Thread 4


Arquitetura e Implementação<br />

Threads em modo híbrido<br />

TMU 0<br />

TMU 1<br />

TMU 2<br />

Biblioteca<br />

TMK 0 TMK 1 TMK 2 TMK 3<br />

Kernel<br />

Modo<br />

usuário<br />

Modo<br />

kernel<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5 3 de junho de 2011<br />

TMU 3<br />

TMU 4<br />

TMU 5


Arquitetura e Implementação<br />

Ativação do Escalonador<br />

Thread 0<br />

Thread 1<br />

Thread 2<br />

Biblioteca<br />

Kernel<br />

Modo<br />

usuário<br />

Modo<br />

kernel<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5 3 de junho de 2011<br />

Thread 3<br />

Thread 4


Dúvidas?<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5<br />

junho de 11


Não percam no próximo episódio!<br />

Início de sincronização;<br />

E muito mais!<br />

Dúvidas?<br />

<strong>Anderson</strong> <strong>Moreira</strong> Sistemas Operacionais – Aula 5 3 de junho de 2011

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!