SlideShare una empresa de Scribd logo
1 de 16
Algoritmos Multihilo
Introducción
Algoritmos Multihilo
• Hasta ahora los algoritmos que hemos visto
son seriales ya que se ejecutan en modelo
RAM (un solo procesador)
• Necesitamos extender modelo RAM para
describir algoritmos que se ejecutan en
paralelo
• La mayor parte de los dispositivos de cómputo
actuales son multiprocesador
Modelos PRAM
• Hay varios tipos de modelos de computadoras
que funcionan en paralelo
• Uno de los principales aspectos en que
difieren es en como se intercambian mensajes
• Existen modelos de memoria compartida y los
de memoria distribuida
• Los computadores actuales son de memoria
compartida
Programación Multihilo Dinámica
• Generalmente nos basamos en una
plataforma de concurrencia (capa de
software)
• El lenguaje de programación (o una
librería) nos provee extensiones simples
en la forma de instrucciones de
concurrencia parallel, spawn, and sync.
Spawn
• Spawn: Si spawn precede a una llamada a función, el
procedimiento que ejecuta la llamada (el padre)
sigue ejecutándose en paralelo con la subrutina
creada (el hijo), en vez de esperar a que el hijo
termine.
Spawn
• Spawn significa que pude ejecutarse en
paralelo, no que es obligatorio
• En tiempo de ejecución, el scheduler decide
que instrucciones se ejecutan de manera
concurrente.
Sync
• La palabra reservada sync indica que un
procedimiento debe esperar hasta que
todos sus hijos creados completen sus
tareas.
Parallel
• Muchos algoritmos contienen lazos.
• Si se utiliza la palabra reservada parallel antes de un lazo form, esto
indica que el cuerpo del lazo puede ser ejecutado en paralelo.
Cálculo de los Números Fibonacci
Multihilo
• Los números Fibonacci son generados por la siguiente definición:
F0 = 0
F1 = 1
para i > 1, Fi = Fi-1 + Fi-2
Algoritmo Fuerza Bruta
Algoritmo de Fuerza Bruta
Fibonacci Multihilo
• Si lo queremos hacer multihilo este sería el algoritmo:
algorithms. Observe that within FIB.n/, the two recursive calls i
FIB.n 1/ and FIB.n 2/, respectively, are independent of each
be called in either order, and the computation performed by one
the other. Therefore, the two recursive calls can run in parallel.
We augment our pseudocode to indicate parallelism by adding
keywords spawn and sync. Here is how we can rewrite the FIB
dynamic multithreading:
P-FIB.n/
1 if n 1
2 return n
3 else x D spawn P-FIB.n 1/
4 y D P-FIB.n 2/
5 sync
6 return x C y
Notice that if we delete the concurrency keywords spawn and s
the resulting pseudocode text is identical to FIB (other than renam
in the header and in the two recursive calls). We define the serial
tithreaded algorithm to be the serial algorithm that results from d
DAG del Algoritmo
• La ejecución multihilo puede comprenderse
mejor con un grafo acícliclo dirigido (DAG)
G=(V,E).
• Los vértices V en el gráfico son las instrucciones.
• Los enlaces E representan la dependencia entre
las instrucciones.
• Si un enlace (u,v) está en E significa que la
instrucción u debe ejecutarse antes de la
instrucción v.
DAG
Strands
algorithms. Observe that within FIB.n/, the two recursive calls i
FIB.n 1/ and FIB.n 2/, respectively, are independent of each
be called in either order, and the computation performed by one
the other. Therefore, the two recursive calls can run in parallel.
We augment our pseudocode to indicate parallelism by adding
keywords spawn and sync. Here is how we can rewrite the FIB
dynamic multithreading:
P-FIB.n/
1 if n 1
2 return n
3 else x D spawn P-FIB.n 1/
4 y D P-FIB.n 2/
5 sync
6 return x C y
Notice that if we delete the concurrency keywords spawn and s
the resulting pseudocode text is identical to FIB (other than renam
in the header and in the two recursive calls). We define the serial
tithreaded algorithm to be the serial algorithm that results from d
Loops Paralelos

Más contenido relacionado

La actualidad más candente

Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound techniqueishmecse13
 
CS6701 CRYPTOGRAPHY AND NETWORK SECURITY
CS6701 CRYPTOGRAPHY AND NETWORK SECURITYCS6701 CRYPTOGRAPHY AND NETWORK SECURITY
CS6701 CRYPTOGRAPHY AND NETWORK SECURITYKathirvel Ayyaswamy
 
Bootstrapping in Compiler
Bootstrapping in CompilerBootstrapping in Compiler
Bootstrapping in CompilerAkhil Kaushik
 
Monoalphabetic Substitution Cipher
Monoalphabetic Substitution  CipherMonoalphabetic Substitution  Cipher
Monoalphabetic Substitution CipherSHUBHA CHATURVEDI
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler DesignKuppusamy P
 
End to End Encryption in 10 minutes -
End to End Encryption in 10 minutes - End to End Encryption in 10 minutes -
End to End Encryption in 10 minutes - Thomas Seropian
 
Top Down Parsing, Predictive Parsing
Top Down Parsing, Predictive ParsingTop Down Parsing, Predictive Parsing
Top Down Parsing, Predictive ParsingTanzeela_Hussain
 
15 puzzle problem using branch and bound
15 puzzle problem using branch and bound15 puzzle problem using branch and bound
15 puzzle problem using branch and boundAbhishek Singh
 
HDLC, PPP and SLIP
HDLC, PPP and SLIPHDLC, PPP and SLIP
HDLC, PPP and SLIPNaveen Kumar
 
Point To Point Protocol
Point To Point ProtocolPoint To Point Protocol
Point To Point ProtocolPhan Vuong
 
Chapter 1 - Computer Networking a top-down Approach 7th
Chapter 1 - Computer Networking a top-down Approach 7thChapter 1 - Computer Networking a top-down Approach 7th
Chapter 1 - Computer Networking a top-down Approach 7thAndy Juan Sarango Veliz
 
8086 module 1 & 2 work
8086 module 1 & 2   work8086 module 1 & 2   work
8086 module 1 & 2 workSuhail Km
 
RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE
RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE
RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE Qualcomm
 
2-Approximation Vertex Cover
2-Approximation Vertex Cover2-Approximation Vertex Cover
2-Approximation Vertex CoverKowshik Roy
 
Classical problems of process synchronization
Classical problems of process synchronizationClassical problems of process synchronization
Classical problems of process synchronizationsangrampatil81
 
Network security cryptographic hash function
Network security  cryptographic hash functionNetwork security  cryptographic hash function
Network security cryptographic hash functionMijanur Rahman Milon
 

La actualidad más candente (20)

Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
 
CS6701 CRYPTOGRAPHY AND NETWORK SECURITY
CS6701 CRYPTOGRAPHY AND NETWORK SECURITYCS6701 CRYPTOGRAPHY AND NETWORK SECURITY
CS6701 CRYPTOGRAPHY AND NETWORK SECURITY
 
Bootstrapping in Compiler
Bootstrapping in CompilerBootstrapping in Compiler
Bootstrapping in Compiler
 
RSA Algorithm report
RSA Algorithm reportRSA Algorithm report
RSA Algorithm report
 
Monoalphabetic Substitution Cipher
Monoalphabetic Substitution  CipherMonoalphabetic Substitution  Cipher
Monoalphabetic Substitution Cipher
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
End to End Encryption in 10 minutes -
End to End Encryption in 10 minutes - End to End Encryption in 10 minutes -
End to End Encryption in 10 minutes -
 
Top Down Parsing, Predictive Parsing
Top Down Parsing, Predictive ParsingTop Down Parsing, Predictive Parsing
Top Down Parsing, Predictive Parsing
 
15 puzzle problem using branch and bound
15 puzzle problem using branch and bound15 puzzle problem using branch and bound
15 puzzle problem using branch and bound
 
HDLC, PPP and SLIP
HDLC, PPP and SLIPHDLC, PPP and SLIP
HDLC, PPP and SLIP
 
Point To Point Protocol
Point To Point ProtocolPoint To Point Protocol
Point To Point Protocol
 
Chapter 1 - Computer Networking a top-down Approach 7th
Chapter 1 - Computer Networking a top-down Approach 7thChapter 1 - Computer Networking a top-down Approach 7th
Chapter 1 - Computer Networking a top-down Approach 7th
 
RSA algorithm
RSA algorithmRSA algorithm
RSA algorithm
 
8086 module 1 & 2 work
8086 module 1 & 2   work8086 module 1 & 2   work
8086 module 1 & 2 work
 
RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE
RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE
RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE
 
2-Approximation Vertex Cover
2-Approximation Vertex Cover2-Approximation Vertex Cover
2-Approximation Vertex Cover
 
Classical problems of process synchronization
Classical problems of process synchronizationClassical problems of process synchronization
Classical problems of process synchronization
 
Theory of Computation Unit 5
Theory of Computation Unit 5Theory of Computation Unit 5
Theory of Computation Unit 5
 
Network security cryptographic hash function
Network security  cryptographic hash functionNetwork security  cryptographic hash function
Network security cryptographic hash function
 
CS6551 COMPUTER NETWORKS
CS6551 COMPUTER NETWORKSCS6551 COMPUTER NETWORKS
CS6551 COMPUTER NETWORKS
 

Destacado

Weekly weather
Weekly weatherWeekly weather
Weekly weathershania95
 
0360chapterone.2
0360chapterone.20360chapterone.2
0360chapterone.2holly_cin
 
Housing Choice Voucher Program At-A-Glance
Housing Choice Voucher Program At-A-GlanceHousing Choice Voucher Program At-A-Glance
Housing Choice Voucher Program At-A-GlanceJessKern
 
Filhinhos - Vou prepara-vos um lugar!!
Filhinhos - Vou prepara-vos um lugar!! Filhinhos - Vou prepara-vos um lugar!!
Filhinhos - Vou prepara-vos um lugar!! Marly Brito
 
A utilização das TIC em contexto educativo.
A utilização das TIC em contexto educativo. A utilização das TIC em contexto educativo.
A utilização das TIC em contexto educativo. Fernando Albuquerque Costa
 
Competências para aprender e competências para ensinar COM TIC
Competências para aprender e competências para ensinar COM TICCompetências para aprender e competências para ensinar COM TIC
Competências para aprender e competências para ensinar COM TICFernando Albuquerque Costa
 
"La innovación pendiente: nuevas formas de evaluar y reconocer el conocimient...
"La innovación pendiente: nuevas formas de evaluar y reconocer el conocimient..."La innovación pendiente: nuevas formas de evaluar y reconocer el conocimient...
"La innovación pendiente: nuevas formas de evaluar y reconocer el conocimient...@cristobalcobo
 
Big data processing using HPCC Systems Above and Beyond Hadoop
Big data processing using HPCC Systems Above and Beyond HadoopBig data processing using HPCC Systems Above and Beyond Hadoop
Big data processing using HPCC Systems Above and Beyond HadoopHPCC Systems
 

Destacado (12)

Stb p hdsl
Stb p hdslStb p hdsl
Stb p hdsl
 
Weekly weather
Weekly weatherWeekly weather
Weekly weather
 
Hpcc
HpccHpcc
Hpcc
 
0360chapterone.2
0360chapterone.20360chapterone.2
0360chapterone.2
 
Housing Choice Voucher Program At-A-Glance
Housing Choice Voucher Program At-A-GlanceHousing Choice Voucher Program At-A-Glance
Housing Choice Voucher Program At-A-Glance
 
La innovacion pendiente (2016) . Cristobal Cobo
La innovacion pendiente (2016) . Cristobal CoboLa innovacion pendiente (2016) . Cristobal Cobo
La innovacion pendiente (2016) . Cristobal Cobo
 
Filhinhos - Vou prepara-vos um lugar!!
Filhinhos - Vou prepara-vos um lugar!! Filhinhos - Vou prepara-vos um lugar!!
Filhinhos - Vou prepara-vos um lugar!!
 
A utilização das TIC em contexto educativo.
A utilização das TIC em contexto educativo. A utilização das TIC em contexto educativo.
A utilização das TIC em contexto educativo.
 
ZIGBEE TECHNOLOGY
ZIGBEE TECHNOLOGYZIGBEE TECHNOLOGY
ZIGBEE TECHNOLOGY
 
Competências para aprender e competências para ensinar COM TIC
Competências para aprender e competências para ensinar COM TICCompetências para aprender e competências para ensinar COM TIC
Competências para aprender e competências para ensinar COM TIC
 
"La innovación pendiente: nuevas formas de evaluar y reconocer el conocimient...
"La innovación pendiente: nuevas formas de evaluar y reconocer el conocimient..."La innovación pendiente: nuevas formas de evaluar y reconocer el conocimient...
"La innovación pendiente: nuevas formas de evaluar y reconocer el conocimient...
 
Big data processing using HPCC Systems Above and Beyond Hadoop
Big data processing using HPCC Systems Above and Beyond HadoopBig data processing using HPCC Systems Above and Beyond Hadoop
Big data processing using HPCC Systems Above and Beyond Hadoop
 

Similar a Algoritmos Multihilo: Introducción a los modelos PRAM y programación dinámica multihilo

Similar a Algoritmos Multihilo: Introducción a los modelos PRAM y programación dinámica multihilo (20)

Taller completo
Taller completoTaller completo
Taller completo
 
Ensamblador
EnsambladorEnsamblador
Ensamblador
 
Apuntes php
Apuntes phpApuntes php
Apuntes php
 
Programacion en php atavez de ejemplos
Programacion en php atavez de ejemplosProgramacion en php atavez de ejemplos
Programacion en php atavez de ejemplos
 
Apuntes php
Apuntes phpApuntes php
Apuntes php
 
Procesadores superescalares
Procesadores superescalaresProcesadores superescalares
Procesadores superescalares
 
Php
PhpPhp
Php
 
Fernando
FernandoFernando
Fernando
 
Introducción a Python
Introducción a PythonIntroducción a Python
Introducción a Python
 
El sistema NWP HARMONIE: Introducción a la Computación de Altas
El sistema NWP HARMONIE: Introducción a la Computación de AltasEl sistema NWP HARMONIE: Introducción a la Computación de Altas
El sistema NWP HARMONIE: Introducción a la Computación de Altas
 
UNIDAD 2 PROGRAMACIÓN BASICA
UNIDAD 2 PROGRAMACIÓN BASICAUNIDAD 2 PROGRAMACIÓN BASICA
UNIDAD 2 PROGRAMACIÓN BASICA
 
Introducción a programación con PHP
Introducción a programación con PHPIntroducción a programación con PHP
Introducción a programación con PHP
 
Apuntes php
Apuntes phpApuntes php
Apuntes php
 
Programacion en php a traves de ejemplos
Programacion en php a traves de ejemplosProgramacion en php a traves de ejemplos
Programacion en php a traves de ejemplos
 
Ejemplos en php
Ejemplos en phpEjemplos en php
Ejemplos en php
 
Apuntes php.pdf ejemplos
Apuntes php.pdf ejemplosApuntes php.pdf ejemplos
Apuntes php.pdf ejemplos
 
Apuntes php
Apuntes phpApuntes php
Apuntes php
 
Apuntes php
Apuntes phpApuntes php
Apuntes php
 
Diseño de Algoritmos Paralelos.pptx
Diseño de Algoritmos Paralelos.pptxDiseño de Algoritmos Paralelos.pptx
Diseño de Algoritmos Paralelos.pptx
 
Formatos de instrucción
Formatos de instrucciónFormatos de instrucción
Formatos de instrucción
 

Más de Xavier Ochoa

Multimodal Learning Analytics
Multimodal Learning AnalyticsMultimodal Learning Analytics
Multimodal Learning AnalyticsXavier Ochoa
 
Supporting the Acquisition of 21st Century Skills through Multimodal Learning...
Supporting the Acquisition of 21st Century Skills through Multimodal Learning...Supporting the Acquisition of 21st Century Skills through Multimodal Learning...
Supporting the Acquisition of 21st Century Skills through Multimodal Learning...Xavier Ochoa
 
Educational Technologies
Educational TechnologiesEducational Technologies
Educational TechnologiesXavier Ochoa
 
Developing 21st-Century Skills with  Multimodal Learning Analytics
Developing 21st-Century Skills with Multimodal Learning AnalyticsDeveloping 21st-Century Skills with Multimodal Learning Analytics
Developing 21st-Century Skills with  Multimodal Learning AnalyticsXavier Ochoa
 
Educational Technologies: Learning Analytics and Artificial Intelligence
Educational Technologies: Learning Analytics and Artificial IntelligenceEducational Technologies: Learning Analytics and Artificial Intelligence
Educational Technologies: Learning Analytics and Artificial IntelligenceXavier Ochoa
 
Analiticas de Aprendizaje: Nuevo paradigma en la investigación educativa
Analiticas de Aprendizaje: Nuevo paradigma en la investigación educativaAnaliticas de Aprendizaje: Nuevo paradigma en la investigación educativa
Analiticas de Aprendizaje: Nuevo paradigma en la investigación educativaXavier Ochoa
 
Analítica del Aprendizaje como Nuevo Paradigma de la Investigación Educativa
Analítica del Aprendizaje como Nuevo Paradigma de la Investigación EducativaAnalítica del Aprendizaje como Nuevo Paradigma de la Investigación Educativa
Analítica del Aprendizaje como Nuevo Paradigma de la Investigación EducativaXavier Ochoa
 
Automatic Feedback for Oral Presentations
Automatic Feedback for Oral PresentationsAutomatic Feedback for Oral Presentations
Automatic Feedback for Oral PresentationsXavier Ochoa
 
LAK-18 Program in Numbers
LAK-18 Program in NumbersLAK-18 Program in Numbers
LAK-18 Program in NumbersXavier Ochoa
 
Multimodal Learning Analytics
Multimodal Learning AnalyticsMultimodal Learning Analytics
Multimodal Learning AnalyticsXavier Ochoa
 
Education as the meta-problem: Opportunities for Technology R&D
Education as the meta-problem: Opportunities for Technology R&DEducation as the meta-problem: Opportunities for Technology R&D
Education as the meta-problem: Opportunities for Technology R&DXavier Ochoa
 
Medir para Entender y Mejorar: la Analítica del Aprendizaje como nuevo paradi...
Medir para Entender y Mejorar: la Analítica del Aprendizaje como nuevo paradi...Medir para Entender y Mejorar: la Analítica del Aprendizaje como nuevo paradi...
Medir para Entender y Mejorar: la Analítica del Aprendizaje como nuevo paradi...Xavier Ochoa
 
Adaptive Multilevel Clustering Model for the Prediction of Academic Risk
Adaptive Multilevel Clustering Model for the Prediction of Academic RiskAdaptive Multilevel Clustering Model for the Prediction of Academic Risk
Adaptive Multilevel Clustering Model for the Prediction of Academic RiskXavier Ochoa
 
Simple metrics for Curricular Analytics
Simple metrics for Curricular AnalyticsSimple metrics for Curricular Analytics
Simple metrics for Curricular AnalyticsXavier Ochoa
 
Multimodal Learning Analytics
Multimodal Learning AnalyticsMultimodal Learning Analytics
Multimodal Learning AnalyticsXavier Ochoa
 
Multimodal Learning Analytics
Multimodal Learning AnalyticsMultimodal Learning Analytics
Multimodal Learning AnalyticsXavier Ochoa
 
Analisis de Algoritmos Multihilo
Analisis de Algoritmos MultihiloAnalisis de Algoritmos Multihilo
Analisis de Algoritmos MultihiloXavier Ochoa
 
Analitica aprendizaje
Analitica aprendizajeAnalitica aprendizaje
Analitica aprendizajeXavier Ochoa
 
Visualizing Uncertainty in the Prediction of Academic Risk
Visualizing Uncertainty in the Prediction of Academic RiskVisualizing Uncertainty in the Prediction of Academic Risk
Visualizing Uncertainty in the Prediction of Academic RiskXavier Ochoa
 
Openness as a Tool
Openness as a ToolOpenness as a Tool
Openness as a ToolXavier Ochoa
 

Más de Xavier Ochoa (20)

Multimodal Learning Analytics
Multimodal Learning AnalyticsMultimodal Learning Analytics
Multimodal Learning Analytics
 
Supporting the Acquisition of 21st Century Skills through Multimodal Learning...
Supporting the Acquisition of 21st Century Skills through Multimodal Learning...Supporting the Acquisition of 21st Century Skills through Multimodal Learning...
Supporting the Acquisition of 21st Century Skills through Multimodal Learning...
 
Educational Technologies
Educational TechnologiesEducational Technologies
Educational Technologies
 
Developing 21st-Century Skills with  Multimodal Learning Analytics
Developing 21st-Century Skills with Multimodal Learning AnalyticsDeveloping 21st-Century Skills with Multimodal Learning Analytics
Developing 21st-Century Skills with  Multimodal Learning Analytics
 
Educational Technologies: Learning Analytics and Artificial Intelligence
Educational Technologies: Learning Analytics and Artificial IntelligenceEducational Technologies: Learning Analytics and Artificial Intelligence
Educational Technologies: Learning Analytics and Artificial Intelligence
 
Analiticas de Aprendizaje: Nuevo paradigma en la investigación educativa
Analiticas de Aprendizaje: Nuevo paradigma en la investigación educativaAnaliticas de Aprendizaje: Nuevo paradigma en la investigación educativa
Analiticas de Aprendizaje: Nuevo paradigma en la investigación educativa
 
Analítica del Aprendizaje como Nuevo Paradigma de la Investigación Educativa
Analítica del Aprendizaje como Nuevo Paradigma de la Investigación EducativaAnalítica del Aprendizaje como Nuevo Paradigma de la Investigación Educativa
Analítica del Aprendizaje como Nuevo Paradigma de la Investigación Educativa
 
Automatic Feedback for Oral Presentations
Automatic Feedback for Oral PresentationsAutomatic Feedback for Oral Presentations
Automatic Feedback for Oral Presentations
 
LAK-18 Program in Numbers
LAK-18 Program in NumbersLAK-18 Program in Numbers
LAK-18 Program in Numbers
 
Multimodal Learning Analytics
Multimodal Learning AnalyticsMultimodal Learning Analytics
Multimodal Learning Analytics
 
Education as the meta-problem: Opportunities for Technology R&D
Education as the meta-problem: Opportunities for Technology R&DEducation as the meta-problem: Opportunities for Technology R&D
Education as the meta-problem: Opportunities for Technology R&D
 
Medir para Entender y Mejorar: la Analítica del Aprendizaje como nuevo paradi...
Medir para Entender y Mejorar: la Analítica del Aprendizaje como nuevo paradi...Medir para Entender y Mejorar: la Analítica del Aprendizaje como nuevo paradi...
Medir para Entender y Mejorar: la Analítica del Aprendizaje como nuevo paradi...
 
Adaptive Multilevel Clustering Model for the Prediction of Academic Risk
Adaptive Multilevel Clustering Model for the Prediction of Academic RiskAdaptive Multilevel Clustering Model for the Prediction of Academic Risk
Adaptive Multilevel Clustering Model for the Prediction of Academic Risk
 
Simple metrics for Curricular Analytics
Simple metrics for Curricular AnalyticsSimple metrics for Curricular Analytics
Simple metrics for Curricular Analytics
 
Multimodal Learning Analytics
Multimodal Learning AnalyticsMultimodal Learning Analytics
Multimodal Learning Analytics
 
Multimodal Learning Analytics
Multimodal Learning AnalyticsMultimodal Learning Analytics
Multimodal Learning Analytics
 
Analisis de Algoritmos Multihilo
Analisis de Algoritmos MultihiloAnalisis de Algoritmos Multihilo
Analisis de Algoritmos Multihilo
 
Analitica aprendizaje
Analitica aprendizajeAnalitica aprendizaje
Analitica aprendizaje
 
Visualizing Uncertainty in the Prediction of Academic Risk
Visualizing Uncertainty in the Prediction of Academic RiskVisualizing Uncertainty in the Prediction of Academic Risk
Visualizing Uncertainty in the Prediction of Academic Risk
 
Openness as a Tool
Openness as a ToolOpenness as a Tool
Openness as a Tool
 

Último

Proyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptxProyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptx241521559
 
pruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNITpruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNITMaricarmen Sánchez Ruiz
 
Desarrollo Web Moderno con Svelte 2024.pdf
Desarrollo Web Moderno con Svelte 2024.pdfDesarrollo Web Moderno con Svelte 2024.pdf
Desarrollo Web Moderno con Svelte 2024.pdfJulian Lamprea
 
Presentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptxPresentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptxLolaBunny11
 
International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)GDGSucre
 
EPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveEPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveFagnerLisboa3
 
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricGlobal Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricKeyla Dolores Méndez
 
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...silviayucra2
 
guía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Josephguía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan JosephBRAYANJOSEPHPEREZGOM
 
Trabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíaTrabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíassuserf18419
 

Último (10)

Proyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptxProyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptx
 
pruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNITpruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNIT
 
Desarrollo Web Moderno con Svelte 2024.pdf
Desarrollo Web Moderno con Svelte 2024.pdfDesarrollo Web Moderno con Svelte 2024.pdf
Desarrollo Web Moderno con Svelte 2024.pdf
 
Presentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptxPresentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptx
 
International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)
 
EPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveEPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial Uninove
 
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricGlobal Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
 
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
 
guía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Josephguía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Joseph
 
Trabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíaTrabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnología
 

Algoritmos Multihilo: Introducción a los modelos PRAM y programación dinámica multihilo

  • 2. Algoritmos Multihilo • Hasta ahora los algoritmos que hemos visto son seriales ya que se ejecutan en modelo RAM (un solo procesador) • Necesitamos extender modelo RAM para describir algoritmos que se ejecutan en paralelo • La mayor parte de los dispositivos de cómputo actuales son multiprocesador
  • 3. Modelos PRAM • Hay varios tipos de modelos de computadoras que funcionan en paralelo • Uno de los principales aspectos en que difieren es en como se intercambian mensajes • Existen modelos de memoria compartida y los de memoria distribuida • Los computadores actuales son de memoria compartida
  • 4. Programación Multihilo Dinámica • Generalmente nos basamos en una plataforma de concurrencia (capa de software) • El lenguaje de programación (o una librería) nos provee extensiones simples en la forma de instrucciones de concurrencia parallel, spawn, and sync.
  • 5. Spawn • Spawn: Si spawn precede a una llamada a función, el procedimiento que ejecuta la llamada (el padre) sigue ejecutándose en paralelo con la subrutina creada (el hijo), en vez de esperar a que el hijo termine.
  • 6. Spawn • Spawn significa que pude ejecutarse en paralelo, no que es obligatorio • En tiempo de ejecución, el scheduler decide que instrucciones se ejecutan de manera concurrente.
  • 7. Sync • La palabra reservada sync indica que un procedimiento debe esperar hasta que todos sus hijos creados completen sus tareas.
  • 8. Parallel • Muchos algoritmos contienen lazos. • Si se utiliza la palabra reservada parallel antes de un lazo form, esto indica que el cuerpo del lazo puede ser ejecutado en paralelo.
  • 9. Cálculo de los Números Fibonacci Multihilo • Los números Fibonacci son generados por la siguiente definición: F0 = 0 F1 = 1 para i > 1, Fi = Fi-1 + Fi-2
  • 12. Fibonacci Multihilo • Si lo queremos hacer multihilo este sería el algoritmo: algorithms. Observe that within FIB.n/, the two recursive calls i FIB.n 1/ and FIB.n 2/, respectively, are independent of each be called in either order, and the computation performed by one the other. Therefore, the two recursive calls can run in parallel. We augment our pseudocode to indicate parallelism by adding keywords spawn and sync. Here is how we can rewrite the FIB dynamic multithreading: P-FIB.n/ 1 if n 1 2 return n 3 else x D spawn P-FIB.n 1/ 4 y D P-FIB.n 2/ 5 sync 6 return x C y Notice that if we delete the concurrency keywords spawn and s the resulting pseudocode text is identical to FIB (other than renam in the header and in the two recursive calls). We define the serial tithreaded algorithm to be the serial algorithm that results from d
  • 13. DAG del Algoritmo • La ejecución multihilo puede comprenderse mejor con un grafo acícliclo dirigido (DAG) G=(V,E). • Los vértices V en el gráfico son las instrucciones. • Los enlaces E representan la dependencia entre las instrucciones. • Si un enlace (u,v) está en E significa que la instrucción u debe ejecutarse antes de la instrucción v.
  • 14. DAG
  • 15. Strands algorithms. Observe that within FIB.n/, the two recursive calls i FIB.n 1/ and FIB.n 2/, respectively, are independent of each be called in either order, and the computation performed by one the other. Therefore, the two recursive calls can run in parallel. We augment our pseudocode to indicate parallelism by adding keywords spawn and sync. Here is how we can rewrite the FIB dynamic multithreading: P-FIB.n/ 1 if n 1 2 return n 3 else x D spawn P-FIB.n 1/ 4 y D P-FIB.n 2/ 5 sync 6 return x C y Notice that if we delete the concurrency keywords spawn and s the resulting pseudocode text is identical to FIB (other than renam in the header and in the two recursive calls). We define the serial tithreaded algorithm to be the serial algorithm that results from d