SlideShare a Scribd company logo
1 of 38
Hilos
Capítulo 5
Silberschatz Galvin
Hilos2
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Hilos
Concepto
Beneficios
Hilos a nivel kérnel y a nivel usuario
Modelos multihilos
Hilos de Solaris 2
Hilos de Java
Hilos3
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Hilos
Un hilo (o proceso ligero) es una unidad básica de utilización
del CPU; consiste de:
• Contador de programa
• Conjunto de registros
• Espacio de stack
Hilos4
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Hilos
Un hilo comparte con sus hilos pares:
• Sección de código
• Sección de datos
• Recursos del sistema operativo
• En conjunto se les conoce como tarea
Un proceso tradicional o pesado, es igual a una tarea con un
hilo.
Hilos5
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
un proceso
un hilo
varios procesos
un hilo por proceso
varios procesos
varios hilos por proceso
un proceso
varios hilos
Hilos y procesos
Hilos6
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Código Datos Archivos Código Datos Archivos
Hilo Hilos
Mono-hilo Multi-hilo
Procesos con un solo hilo y con múltiples
hilos
Hilos7
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Bloque de
control
del hilo
Stack
del
usuario
Stack
del
usuario
Stack
del
kernel
Stack
del
Kernel
Espacio de
direcciones
del usuario
Espacio de
direcciones
del usuario
Bloque de
control del
proceso
Bloque
de control
del proceso
Hilo
Modelo de proceso
de un solo hilo
Modelo de proceso
multihilos
Bloque de
control
del hilo
Stack
del
usuario
Stack
del
kernel
Hilo
Bloque de
control
del hilo
Stack
del
usuario
Stack
del
kernel
Hilo
Modelos de procesos de un solo hilo y de
muchos hilos
Hilos8
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Multihilo
Sistema operativo que mantiene varios hilos de ejecución
dentro de un mismo proceso.
MS-DOS soporta un solo hilo.
UNIX soporta múltiples procesos de usuarios, pero sólo un hilo
por proceso.
Windows 2000, Solaris, Linux, Mac OS, OS/2 soportan múltiples
hilos.
Hilos9
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Hilos
En una tarea donde hay múltiples hilos, mientras un hilo
servidor está bloqueado y esperando, otro hilo en la misma
tarea puede ejecutarse.
• Cooperación de múltiples hilos en la misma tarea aumenta la
tasa de trabajos por unidad tiempo y mejora el rendimiento.
• Aplicaciones que requieren compartir un buffer común
(productor-consumidor) sacan provecho de la utilización de
hilos.
Hilos10
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Hilos
Los hilos proveen un mecanismo que permiten a procesos
secuenciales hacer llamadas bloqueantes mientras otros en
paralelo ejecutan otras operaciones.
Hilos11
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Beneficios
Compartición de recursos
Economía
Utilización de arquitecturas de múltiples procesadores
Hilos12
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Hilos a nivel usuario
El manejo de los hilos lo hace una librería de hilos a nivel
usuario
Ejemplos
- Hilos POSIX
- Mach C-threads
- Hilos de Solaris
Hilos13
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Hilos a nivel usuario (un CPU con dos
núcleos)
Nivel kérnel
(sistema
operativo)
Nivel usuario
Proceso de usuario gestiona y
planifica los múltiples hilos
Core CoreCPU
Hardware
Planificador del SO
Hilos14
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Ventajas de los hilos a nivel usuario
Los hilos podían implementarse en las aplicaciones que se
ejecutaban en sistemas operativos que no son capaces de
planificar hilos
• Ejemplo: Primeras implementaciones de UNIX
Hilos15
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Desventajas de los hilos a nivel usuario
El planificador del sistema operativo solo ve un hilo por proceso
 No ve los hilos a nivel usuario
 Usa un solo núcleo del procesador en un procesador que tiene
más de un núcleo
 No puede distribuir los hilos a nivel el usuario en los dos
núcleos
Hilos16
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Hilos a nivel kérnel
Soportados por el kérnel
Ejemplos
• Windows 95/98/NT
• Solaris
• Linux
• Mac OS
Hilos17
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Hilos a nivel kernel (con un CPU con un solo
núcleo)
Nivel kérnel
(sistema
operativo)
Nivel usuario
CoreCPU
Hardware
Planificador del SO
Hilos18
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Hilos a nivel kernel (con un CPU con doble
núcleo)
Nivel kérnel
(sistema
operativo)
Nivel usuario
Core CoreCPU
Hardware
Planificador del SO
Hilos19
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Ventajas de los hilos a nivel kérnel
El proceso de usuario no se tiene que encargar de la
planificación de los hilos
Si tenemos un procesador con más de un núcelo, el Sistema
operativo puede planificar los hilos en diferentes núcleos
Hilos20
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Modelos multihilos
Muchos a uno
Uno a uno
Muchos a muchos
Hilos21
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Muchos a uno
Muchos hilos a nivel usuario mapeados a un hilo a nivel kérnel.
Usado en sistemas que no soportan hilos a nivel kérnel.
Hilos22
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Modelo muchos a uno
kk
Hilos23
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
EjecuciónListo
Listo
Relaciones entre estados de ULTs y estados
de procesos
Ejecución
Bloqueado
Bloqueado
Listo Ejecución
Bloqueado
Hilo 1
Hilo 2
Proceso B
Kernel
Usuario
Hilos24
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Uno a uno
Cada hilo a nivel usuario corresponde a un hilo del kérnel.
Ejemplos:
- Windows 95/98/NT
- OS/2
Hilos25
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Modelo uno a uno
kk kk kk kk
Hilo a nivel usuario
Hilo a nivel kérnel
Hilos26
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Modelo muchos a muchos
kk kkkk
Hilo a nivel usuario
Hilo a nivel kérnel
Hilos27
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Soporte de hilos en Solaris 2
Solaris 2 es una versión de UNIX con soporte para hilos a nivel
kernel y a nivel usuario, procesamiento simétrico y planificación
en tiempo real.
Hilos28
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Soporte de hilos en Solaris 2
LWP – Nivel intermedio entre los hilos a nivel kernel y los hilos
a nivel usuario.
Hilos29
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Hilos en Solaris 2. Recursos necesarios para
los tipos de hilos
Hilos del kernel
• Estructura de datos pequeña y un stack
• El intercambio de hilos no requiere cambiar la información del
acceso a memoria
• Cambios de hilos relativamente rápidos
Hilos30
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Hilos en Solaris 2. Recursos necesarios para
los tipos de hilos
LWP
• PCB con datos de los registros
• Información sobre la memoria
• El intercambio entre LWP es relativamente lento
Hilos31
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Hilos en Solaris 2. Recursos necesarios para
los tipos de hilos
Hilos a nivel usuario
• Solo requiere un stack y un contador de programa
• No involucrar al kernel significa un intercambio rápido
• El kernel solo ve los LWP que soporta los hilos a nivel usuario
Hilos32
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Usuario
Núcleo
Hardware
Biblioteca
de hilos
Hilo a nivel de
usuario
Hilo del núcleo Proceso ligero Procesador
LL L LL L L L L
L P
P P P P P
Proceso 1 Proceso 2 Proceso 3 Proceso 4 Proceso 5
Ejemplo de la arquitectura multihilo de
Solaris
Hilos33
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Gestión de hilos básica
Un hilo tiene :
• Un identificador (ID)
• Una pila
• Una prioridad de ejecución
• Una dirección de inicio de ejecución.
Hilos34
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Gestión de hilos básica
(POSIX)
Se dice que un hilo es dinámico si se puede crear en cualquier
instante durante la ejecución.
En POSIX :
• los hilos se crean dinámicamente con la función
pthread_create.
• pthread_exit termina el hilo que la invoca.
Hilos35
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Gestión de hilos básica (POSIX), ejemplo:
Programa que crea un hilo donde muestra el mensaje “Hola
Mundo”
Para compilar el programa :
• $ cc -D_REENTRANT thread2.c -o thread2 -lpthread
Hilos36
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
int main()
{
pthread_create(a_thread,funcion_hilo);
pthread_join(a_thread);
}
funcion_hilo()
{
…
}
Crea un hilo
nuevo
Espera a que
termine el hilo
creado
Hilo principal
Hilo creado con la llamada
pthread_create
Hilos37
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Gestión de hilos básica
(POSIX)
Pthread_join()
• Hilo que ejecuta pthread_join, espera a que termine otro hilo
El hilo principal debe esperar a que terminen todos los hilos
creados
• Si el hilo principal no espera a que terminen los hilos creados,
al terminar termina el proceso con todos los hilos.
Hilos38
Copyright © 2006, Intel Corporation. All rights reserved.
Sistemas Operativos
Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners.
Hilos en memoria
Código
(compartido)
Datos
(compartidos)
Int cont=0 (var. Global)
Stack (de cada hilo)
Int i
(var local)
Stack (de cada hilo)
Int i
(var local)

More Related Content

What's hot

大規模DCのネットワークデザイン
大規模DCのネットワークデザイン大規模DCのネットワークデザイン
大規模DCのネットワークデザインMasayuki Kobayashi
 
DPDKによる高速コンテナネットワーキング
DPDKによる高速コンテナネットワーキングDPDKによる高速コンテナネットワーキング
DPDKによる高速コンテナネットワーキングTomoya Hibi
 
ver.12.9_LAPRAS SCOUTサービスご案内資料.pdf
ver.12.9_LAPRAS SCOUTサービスご案内資料.pdfver.12.9_LAPRAS SCOUTサービスご案内資料.pdf
ver.12.9_LAPRAS SCOUTサービスご案内資料.pdfsaito chinatsu
 
SD-WAN導入の現場でみえてきたアレコレ
SD-WAN導入の現場でみえてきたアレコレSD-WAN導入の現場でみえてきたアレコレ
SD-WAN導入の現場でみえてきたアレコレKoji Komatsu
 
【Interop Tokyo 2018】 Telemetryの匠が解説~オープン技術を用いたマイクロバースト検知の最前線~
【Interop Tokyo 2018】 Telemetryの匠が解説~オープン技術を用いたマイクロバースト検知の最前線~【Interop Tokyo 2018】 Telemetryの匠が解説~オープン技術を用いたマイクロバースト検知の最前線~
【Interop Tokyo 2018】 Telemetryの匠が解説~オープン技術を用いたマイクロバースト検知の最前線~Juniper Networks (日本)
 
金勘定のためのBigDecimalそしてMoney and Currency API
金勘定のためのBigDecimalそしてMoney and Currency API金勘定のためのBigDecimalそしてMoney and Currency API
金勘定のためのBigDecimalそしてMoney and Currency APITaku Miyakawa
 
バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~
バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~
バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~Ryota Watabe
 
BGP Unnumbered で遊んでみた
BGP Unnumbered で遊んでみたBGP Unnumbered で遊んでみた
BGP Unnumbered で遊んでみたakira6592
 
OpenStack超入門シリーズ いまさら聞けないSwiftの使い方
OpenStack超入門シリーズ いまさら聞けないSwiftの使い方OpenStack超入門シリーズ いまさら聞けないSwiftの使い方
OpenStack超入門シリーズ いまさら聞けないSwiftの使い方Toru Makabe
 
初めてのデータ分析基盤構築をまかされた、その時何を考えておくと良いのか
初めてのデータ分析基盤構築をまかされた、その時何を考えておくと良いのか初めてのデータ分析基盤構築をまかされた、その時何を考えておくと良いのか
初めてのデータ分析基盤構築をまかされた、その時何を考えておくと良いのかTechon Organization
 

What's hot (20)

大規模DCのネットワークデザイン
大規模DCのネットワークデザイン大規模DCのネットワークデザイン
大規模DCのネットワークデザイン
 
Сүлжээ
СүлжээСүлжээ
Сүлжээ
 
Dpdk pmd
Dpdk pmdDpdk pmd
Dpdk pmd
 
Өгөгдлийн бүтэц 2-3
Өгөгдлийн бүтэц 2-3Өгөгдлийн бүтэц 2-3
Өгөгдлийн бүтэц 2-3
 
B-link-tree
B-link-treeB-link-tree
B-link-tree
 
DPDKによる高速コンテナネットワーキング
DPDKによる高速コンテナネットワーキングDPDKによる高速コンテナネットワーキング
DPDKによる高速コンテナネットワーキング
 
5 клас урок 8
5 клас урок 85 клас урок 8
5 клас урок 8
 
ver.12.9_LAPRAS SCOUTサービスご案内資料.pdf
ver.12.9_LAPRAS SCOUTサービスご案内資料.pdfver.12.9_LAPRAS SCOUTサービスご案内資料.pdf
ver.12.9_LAPRAS SCOUTサービスご案内資料.pdf
 
4 клас урок 7 як вводити текст
4 клас урок 7 як вводити текст4 клас урок 7 як вводити текст
4 клас урок 7 як вводити текст
 
SD-WAN導入の現場でみえてきたアレコレ
SD-WAN導入の現場でみえてきたアレコレSD-WAN導入の現場でみえてきたアレコレ
SD-WAN導入の現場でみえてきたアレコレ
 
Lecture8
Lecture8Lecture8
Lecture8
 
【Interop Tokyo 2018】 Telemetryの匠が解説~オープン技術を用いたマイクロバースト検知の最前線~
【Interop Tokyo 2018】 Telemetryの匠が解説~オープン技術を用いたマイクロバースト検知の最前線~【Interop Tokyo 2018】 Telemetryの匠が解説~オープン技術を用いたマイクロバースト検知の最前線~
【Interop Tokyo 2018】 Telemetryの匠が解説~オープン技術を用いたマイクロバースト検知の最前線~
 
金勘定のためのBigDecimalそしてMoney and Currency API
金勘定のためのBigDecimalそしてMoney and Currency API金勘定のためのBigDecimalそしてMoney and Currency API
金勘定のためのBigDecimalそしてMoney and Currency API
 
Sw203 Lecture5 Class Acess Modifiers
Sw203 Lecture5 Class Acess ModifiersSw203 Lecture5 Class Acess Modifiers
Sw203 Lecture5 Class Acess Modifiers
 
バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~
バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~
バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~
 
BGP Unnumbered で遊んでみた
BGP Unnumbered で遊んでみたBGP Unnumbered で遊んでみた
BGP Unnumbered で遊んでみた
 
OpenStack超入門シリーズ いまさら聞けないSwiftの使い方
OpenStack超入門シリーズ いまさら聞けないSwiftの使い方OpenStack超入門シリーズ いまさら聞けないSwiftの使い方
OpenStack超入門シリーズ いまさら聞けないSwiftの使い方
 
Өгөгдлийн бүтэц 10
Өгөгдлийн бүтэц 10Өгөгдлийн бүтэц 10
Өгөгдлийн бүтэц 10
 
初めてのデータ分析基盤構築をまかされた、その時何を考えておくと良いのか
初めてのデータ分析基盤構築をまかされた、その時何を考えておくと良いのか初めてのデータ分析基盤構築をまかされた、その時何を考えておくと良いのか
初めてのデータ分析基盤構築をまかされた、その時何を考えておくと良いのか
 
Lec06 synchronization
Lec06 synchronizationLec06 synchronization
Lec06 synchronization
 

Similar to Understanding Threads in Operating Systems

Intel® Trace Analyzer e Collector (ITAC) - Intel Software Conference 2013
Intel® Trace Analyzer e Collector (ITAC) - Intel Software Conference 2013Intel® Trace Analyzer e Collector (ITAC) - Intel Software Conference 2013
Intel® Trace Analyzer e Collector (ITAC) - Intel Software Conference 2013Intel Software Brasil
 
Features of modern intel microprocessors
Features of modern intel microprocessorsFeatures of modern intel microprocessors
Features of modern intel microprocessorsKrunal Siddhapathak
 
17294_HiperSockets.pdf
17294_HiperSockets.pdf17294_HiperSockets.pdf
17294_HiperSockets.pdfEeszt
 
Introduction ciot workshop premeetup
Introduction ciot workshop premeetupIntroduction ciot workshop premeetup
Introduction ciot workshop premeetupBeMyApp
 
Intel® MPI Library e OpenMP* - Intel Software Conference 2013
Intel® MPI Library e OpenMP* - Intel Software Conference 2013Intel® MPI Library e OpenMP* - Intel Software Conference 2013
Intel® MPI Library e OpenMP* - Intel Software Conference 2013Intel Software Brasil
 
Linux on Z13 and Simulatenus Multithreading - Sebastien Llaurency
Linux on Z13 and Simulatenus Multithreading - Sebastien LlaurencyLinux on Z13 and Simulatenus Multithreading - Sebastien Llaurency
Linux on Z13 and Simulatenus Multithreading - Sebastien LlaurencyNRB
 
Intel Technologies for High Performance Computing
Intel Technologies for High Performance ComputingIntel Technologies for High Performance Computing
Intel Technologies for High Performance ComputingIntel Software Brasil
 
Intel® VTune™ Amplifier - Intel Software Conference 2013
Intel® VTune™ Amplifier - Intel Software Conference 2013Intel® VTune™ Amplifier - Intel Software Conference 2013
Intel® VTune™ Amplifier - Intel Software Conference 2013Intel Software Brasil
 
Apache HDFS Extended Attributes and Transparent Encryption
Apache HDFS Extended Attributes and Transparent EncryptionApache HDFS Extended Attributes and Transparent Encryption
Apache HDFS Extended Attributes and Transparent EncryptionUma Maheswara Rao Gangumalla
 
NFF-GO (YANFF) - Yet Another Network Function Framework
NFF-GO (YANFF) - Yet Another Network Function FrameworkNFF-GO (YANFF) - Yet Another Network Function Framework
NFF-GO (YANFF) - Yet Another Network Function FrameworkMichelle Holley
 
Using JavaScript to Build HTML5 Tools (Ian Maffett)
Using JavaScript to Build HTML5 Tools (Ian Maffett)Using JavaScript to Build HTML5 Tools (Ian Maffett)
Using JavaScript to Build HTML5 Tools (Ian Maffett)Future Insights
 
What are latest new features that DPDK brings into 2018?
What are latest new features that DPDK brings into 2018?What are latest new features that DPDK brings into 2018?
What are latest new features that DPDK brings into 2018?Michelle Holley
 
Intel XDK - Philly JS
Intel XDK - Philly JSIntel XDK - Philly JS
Intel XDK - Philly JSIan Maffett
 
Intel NFVi Enabling Kit Demo/Lab
Intel NFVi Enabling Kit Demo/LabIntel NFVi Enabling Kit Demo/Lab
Intel NFVi Enabling Kit Demo/LabMichelle Holley
 
OpenStack and z/VM – What is it and how do I get it?
OpenStack and z/VM – What is it and how do I get it?OpenStack and z/VM – What is it and how do I get it?
OpenStack and z/VM – What is it and how do I get it?Anderson Bassani
 
Methods and practices to analyze the performance of your application with Int...
Methods and practices to analyze the performance of your application with Int...Methods and practices to analyze the performance of your application with Int...
Methods and practices to analyze the performance of your application with Int...Intel Software Brasil
 
Cots moves to multicore: Wind River
Cots moves to multicore: Wind RiverCots moves to multicore: Wind River
Cots moves to multicore: Wind RiverKonrad Witte
 
Embree Ray Tracing Kernels
Embree Ray Tracing KernelsEmbree Ray Tracing Kernels
Embree Ray Tracing KernelsIntel® Software
 
Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...
Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...
Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...Intel® Software
 

Similar to Understanding Threads in Operating Systems (20)

Intel® Trace Analyzer e Collector (ITAC) - Intel Software Conference 2013
Intel® Trace Analyzer e Collector (ITAC) - Intel Software Conference 2013Intel® Trace Analyzer e Collector (ITAC) - Intel Software Conference 2013
Intel® Trace Analyzer e Collector (ITAC) - Intel Software Conference 2013
 
Features of modern intel microprocessors
Features of modern intel microprocessorsFeatures of modern intel microprocessors
Features of modern intel microprocessors
 
17294_HiperSockets.pdf
17294_HiperSockets.pdf17294_HiperSockets.pdf
17294_HiperSockets.pdf
 
Introduction ciot workshop premeetup
Introduction ciot workshop premeetupIntroduction ciot workshop premeetup
Introduction ciot workshop premeetup
 
Intel® MPI Library e OpenMP* - Intel Software Conference 2013
Intel® MPI Library e OpenMP* - Intel Software Conference 2013Intel® MPI Library e OpenMP* - Intel Software Conference 2013
Intel® MPI Library e OpenMP* - Intel Software Conference 2013
 
Linux on Z13 and Simulatenus Multithreading - Sebastien Llaurency
Linux on Z13 and Simulatenus Multithreading - Sebastien LlaurencyLinux on Z13 and Simulatenus Multithreading - Sebastien Llaurency
Linux on Z13 and Simulatenus Multithreading - Sebastien Llaurency
 
Intel Technologies for High Performance Computing
Intel Technologies for High Performance ComputingIntel Technologies for High Performance Computing
Intel Technologies for High Performance Computing
 
Intel® VTune™ Amplifier - Intel Software Conference 2013
Intel® VTune™ Amplifier - Intel Software Conference 2013Intel® VTune™ Amplifier - Intel Software Conference 2013
Intel® VTune™ Amplifier - Intel Software Conference 2013
 
Apache HDFS Extended Attributes and Transparent Encryption
Apache HDFS Extended Attributes and Transparent EncryptionApache HDFS Extended Attributes and Transparent Encryption
Apache HDFS Extended Attributes and Transparent Encryption
 
NFF-GO (YANFF) - Yet Another Network Function Framework
NFF-GO (YANFF) - Yet Another Network Function FrameworkNFF-GO (YANFF) - Yet Another Network Function Framework
NFF-GO (YANFF) - Yet Another Network Function Framework
 
Using JavaScript to Build HTML5 Tools (Ian Maffett)
Using JavaScript to Build HTML5 Tools (Ian Maffett)Using JavaScript to Build HTML5 Tools (Ian Maffett)
Using JavaScript to Build HTML5 Tools (Ian Maffett)
 
What are latest new features that DPDK brings into 2018?
What are latest new features that DPDK brings into 2018?What are latest new features that DPDK brings into 2018?
What are latest new features that DPDK brings into 2018?
 
Intel XDK - Philly JS
Intel XDK - Philly JSIntel XDK - Philly JS
Intel XDK - Philly JS
 
Intel NFVi Enabling Kit Demo/Lab
Intel NFVi Enabling Kit Demo/LabIntel NFVi Enabling Kit Demo/Lab
Intel NFVi Enabling Kit Demo/Lab
 
Intel tools to optimize HPC systems
Intel tools to optimize HPC systemsIntel tools to optimize HPC systems
Intel tools to optimize HPC systems
 
OpenStack and z/VM – What is it and how do I get it?
OpenStack and z/VM – What is it and how do I get it?OpenStack and z/VM – What is it and how do I get it?
OpenStack and z/VM – What is it and how do I get it?
 
Methods and practices to analyze the performance of your application with Int...
Methods and practices to analyze the performance of your application with Int...Methods and practices to analyze the performance of your application with Int...
Methods and practices to analyze the performance of your application with Int...
 
Cots moves to multicore: Wind River
Cots moves to multicore: Wind RiverCots moves to multicore: Wind River
Cots moves to multicore: Wind River
 
Embree Ray Tracing Kernels
Embree Ray Tracing KernelsEmbree Ray Tracing Kernels
Embree Ray Tracing Kernels
 
Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...
Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...
Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...
 

More from Ichinose 11

Mapa mental gilberto ramos itdo acosta_erik solis
Mapa mental gilberto ramos itdo acosta_erik solisMapa mental gilberto ramos itdo acosta_erik solis
Mapa mental gilberto ramos itdo acosta_erik solisIchinose 11
 
Laboratorio n4 sistemas_operativos_gilberto_ramos_9-748-1883
Laboratorio n4 sistemas_operativos_gilberto_ramos_9-748-1883Laboratorio n4 sistemas_operativos_gilberto_ramos_9-748-1883
Laboratorio n4 sistemas_operativos_gilberto_ramos_9-748-1883Ichinose 11
 
Laboratorio n3 sistemas_operativos_gilberto_ramos_9-748-1883
Laboratorio n3 sistemas_operativos_gilberto_ramos_9-748-1883Laboratorio n3 sistemas_operativos_gilberto_ramos_9-748-1883
Laboratorio n3 sistemas_operativos_gilberto_ramos_9-748-1883Ichinose 11
 
Laboratorio#2 sistemas operativos gilberto ramos..
Laboratorio#2 sistemas operativos gilberto ramos..Laboratorio#2 sistemas operativos gilberto ramos..
Laboratorio#2 sistemas operativos gilberto ramos..Ichinose 11
 
Laboratorio n1 sistemas_operativos_gilberto_ramos_9-748-1883
Laboratorio n1 sistemas_operativos_gilberto_ramos_9-748-1883 Laboratorio n1 sistemas_operativos_gilberto_ramos_9-748-1883
Laboratorio n1 sistemas_operativos_gilberto_ramos_9-748-1883 Ichinose 11
 
Sistema compañeros
Sistema         compañerosSistema         compañeros
Sistema compañerosIchinose 11
 
Presentacion memoria
Presentacion memoriaPresentacion memoria
Presentacion memoriaIchinose 11
 
Sincronización entre procesos
Sincronización entre procesosSincronización entre procesos
Sincronización entre procesosIchinose 11
 

More from Ichinose 11 (12)

Mapa mental gilberto ramos itdo acosta_erik solis
Mapa mental gilberto ramos itdo acosta_erik solisMapa mental gilberto ramos itdo acosta_erik solis
Mapa mental gilberto ramos itdo acosta_erik solis
 
Laboratorio n4 sistemas_operativos_gilberto_ramos_9-748-1883
Laboratorio n4 sistemas_operativos_gilberto_ramos_9-748-1883Laboratorio n4 sistemas_operativos_gilberto_ramos_9-748-1883
Laboratorio n4 sistemas_operativos_gilberto_ramos_9-748-1883
 
Laboratorio n3 sistemas_operativos_gilberto_ramos_9-748-1883
Laboratorio n3 sistemas_operativos_gilberto_ramos_9-748-1883Laboratorio n3 sistemas_operativos_gilberto_ramos_9-748-1883
Laboratorio n3 sistemas_operativos_gilberto_ramos_9-748-1883
 
Laboratorio#2 sistemas operativos gilberto ramos..
Laboratorio#2 sistemas operativos gilberto ramos..Laboratorio#2 sistemas operativos gilberto ramos..
Laboratorio#2 sistemas operativos gilberto ramos..
 
Laboratorio n1 sistemas_operativos_gilberto_ramos_9-748-1883
Laboratorio n1 sistemas_operativos_gilberto_ramos_9-748-1883 Laboratorio n1 sistemas_operativos_gilberto_ramos_9-748-1883
Laboratorio n1 sistemas_operativos_gilberto_ramos_9-748-1883
 
Ubuntu touch
Ubuntu  touchUbuntu  touch
Ubuntu touch
 
Sistema compañeros
Sistema         compañerosSistema         compañeros
Sistema compañeros
 
Archivos 2016
Archivos 2016Archivos 2016
Archivos 2016
 
Bloqueos _
Bloqueos _Bloqueos _
Bloqueos _
 
Presentacion memoria
Presentacion memoriaPresentacion memoria
Presentacion memoria
 
Memoria 3
Memoria 3Memoria 3
Memoria 3
 
Sincronización entre procesos
Sincronización entre procesosSincronización entre procesos
Sincronización entre procesos
 

Recently uploaded

Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 
Deliver Latency Free Customer Experience
Deliver Latency Free Customer ExperienceDeliver Latency Free Customer Experience
Deliver Latency Free Customer ExperienceOpsTree solutions
 
Which standard is best for your content?
Which standard is best for your content?Which standard is best for your content?
Which standard is best for your content?Rustici Software
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Laying the Data Foundations for Artificial Intelligence!
Laying the Data Foundations for Artificial Intelligence!Laying the Data Foundations for Artificial Intelligence!
Laying the Data Foundations for Artificial Intelligence!Memoori
 
Dublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptxDublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptxKunal Gupta
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Automation Ops Series: Session 3 - Solutions management
Automation Ops Series: Session 3 - Solutions managementAutomation Ops Series: Session 3 - Solutions management
Automation Ops Series: Session 3 - Solutions managementDianaGray10
 
A PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptxA PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptxatharvdev2010
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 

Recently uploaded (20)

Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 
Deliver Latency Free Customer Experience
Deliver Latency Free Customer ExperienceDeliver Latency Free Customer Experience
Deliver Latency Free Customer Experience
 
Which standard is best for your content?
Which standard is best for your content?Which standard is best for your content?
Which standard is best for your content?
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Laying the Data Foundations for Artificial Intelligence!
Laying the Data Foundations for Artificial Intelligence!Laying the Data Foundations for Artificial Intelligence!
Laying the Data Foundations for Artificial Intelligence!
 
Dublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptxDublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptx
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Automation Ops Series: Session 3 - Solutions management
Automation Ops Series: Session 3 - Solutions managementAutomation Ops Series: Session 3 - Solutions management
Automation Ops Series: Session 3 - Solutions management
 
A PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptxA PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptx
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 

Understanding Threads in Operating Systems

  • 2. Hilos2 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Hilos Concepto Beneficios Hilos a nivel kérnel y a nivel usuario Modelos multihilos Hilos de Solaris 2 Hilos de Java
  • 3. Hilos3 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Hilos Un hilo (o proceso ligero) es una unidad básica de utilización del CPU; consiste de: • Contador de programa • Conjunto de registros • Espacio de stack
  • 4. Hilos4 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Hilos Un hilo comparte con sus hilos pares: • Sección de código • Sección de datos • Recursos del sistema operativo • En conjunto se les conoce como tarea Un proceso tradicional o pesado, es igual a una tarea con un hilo.
  • 5. Hilos5 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. un proceso un hilo varios procesos un hilo por proceso varios procesos varios hilos por proceso un proceso varios hilos Hilos y procesos
  • 6. Hilos6 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Código Datos Archivos Código Datos Archivos Hilo Hilos Mono-hilo Multi-hilo Procesos con un solo hilo y con múltiples hilos
  • 7. Hilos7 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Bloque de control del hilo Stack del usuario Stack del usuario Stack del kernel Stack del Kernel Espacio de direcciones del usuario Espacio de direcciones del usuario Bloque de control del proceso Bloque de control del proceso Hilo Modelo de proceso de un solo hilo Modelo de proceso multihilos Bloque de control del hilo Stack del usuario Stack del kernel Hilo Bloque de control del hilo Stack del usuario Stack del kernel Hilo Modelos de procesos de un solo hilo y de muchos hilos
  • 8. Hilos8 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Multihilo Sistema operativo que mantiene varios hilos de ejecución dentro de un mismo proceso. MS-DOS soporta un solo hilo. UNIX soporta múltiples procesos de usuarios, pero sólo un hilo por proceso. Windows 2000, Solaris, Linux, Mac OS, OS/2 soportan múltiples hilos.
  • 9. Hilos9 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Hilos En una tarea donde hay múltiples hilos, mientras un hilo servidor está bloqueado y esperando, otro hilo en la misma tarea puede ejecutarse. • Cooperación de múltiples hilos en la misma tarea aumenta la tasa de trabajos por unidad tiempo y mejora el rendimiento. • Aplicaciones que requieren compartir un buffer común (productor-consumidor) sacan provecho de la utilización de hilos.
  • 10. Hilos10 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Hilos Los hilos proveen un mecanismo que permiten a procesos secuenciales hacer llamadas bloqueantes mientras otros en paralelo ejecutan otras operaciones.
  • 11. Hilos11 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Beneficios Compartición de recursos Economía Utilización de arquitecturas de múltiples procesadores
  • 12. Hilos12 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Hilos a nivel usuario El manejo de los hilos lo hace una librería de hilos a nivel usuario Ejemplos - Hilos POSIX - Mach C-threads - Hilos de Solaris
  • 13. Hilos13 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Hilos a nivel usuario (un CPU con dos núcleos) Nivel kérnel (sistema operativo) Nivel usuario Proceso de usuario gestiona y planifica los múltiples hilos Core CoreCPU Hardware Planificador del SO
  • 14. Hilos14 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Ventajas de los hilos a nivel usuario Los hilos podían implementarse en las aplicaciones que se ejecutaban en sistemas operativos que no son capaces de planificar hilos • Ejemplo: Primeras implementaciones de UNIX
  • 15. Hilos15 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Desventajas de los hilos a nivel usuario El planificador del sistema operativo solo ve un hilo por proceso  No ve los hilos a nivel usuario  Usa un solo núcleo del procesador en un procesador que tiene más de un núcleo  No puede distribuir los hilos a nivel el usuario en los dos núcleos
  • 16. Hilos16 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Hilos a nivel kérnel Soportados por el kérnel Ejemplos • Windows 95/98/NT • Solaris • Linux • Mac OS
  • 17. Hilos17 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Hilos a nivel kernel (con un CPU con un solo núcleo) Nivel kérnel (sistema operativo) Nivel usuario CoreCPU Hardware Planificador del SO
  • 18. Hilos18 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Hilos a nivel kernel (con un CPU con doble núcleo) Nivel kérnel (sistema operativo) Nivel usuario Core CoreCPU Hardware Planificador del SO
  • 19. Hilos19 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Ventajas de los hilos a nivel kérnel El proceso de usuario no se tiene que encargar de la planificación de los hilos Si tenemos un procesador con más de un núcelo, el Sistema operativo puede planificar los hilos en diferentes núcleos
  • 20. Hilos20 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Modelos multihilos Muchos a uno Uno a uno Muchos a muchos
  • 21. Hilos21 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Muchos a uno Muchos hilos a nivel usuario mapeados a un hilo a nivel kérnel. Usado en sistemas que no soportan hilos a nivel kérnel.
  • 22. Hilos22 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Modelo muchos a uno kk
  • 23. Hilos23 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. EjecuciónListo Listo Relaciones entre estados de ULTs y estados de procesos Ejecución Bloqueado Bloqueado Listo Ejecución Bloqueado Hilo 1 Hilo 2 Proceso B Kernel Usuario
  • 24. Hilos24 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Uno a uno Cada hilo a nivel usuario corresponde a un hilo del kérnel. Ejemplos: - Windows 95/98/NT - OS/2
  • 25. Hilos25 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Modelo uno a uno kk kk kk kk Hilo a nivel usuario Hilo a nivel kérnel
  • 26. Hilos26 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Modelo muchos a muchos kk kkkk Hilo a nivel usuario Hilo a nivel kérnel
  • 27. Hilos27 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Soporte de hilos en Solaris 2 Solaris 2 es una versión de UNIX con soporte para hilos a nivel kernel y a nivel usuario, procesamiento simétrico y planificación en tiempo real.
  • 28. Hilos28 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Soporte de hilos en Solaris 2 LWP – Nivel intermedio entre los hilos a nivel kernel y los hilos a nivel usuario.
  • 29. Hilos29 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Hilos en Solaris 2. Recursos necesarios para los tipos de hilos Hilos del kernel • Estructura de datos pequeña y un stack • El intercambio de hilos no requiere cambiar la información del acceso a memoria • Cambios de hilos relativamente rápidos
  • 30. Hilos30 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Hilos en Solaris 2. Recursos necesarios para los tipos de hilos LWP • PCB con datos de los registros • Información sobre la memoria • El intercambio entre LWP es relativamente lento
  • 31. Hilos31 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Hilos en Solaris 2. Recursos necesarios para los tipos de hilos Hilos a nivel usuario • Solo requiere un stack y un contador de programa • No involucrar al kernel significa un intercambio rápido • El kernel solo ve los LWP que soporta los hilos a nivel usuario
  • 32. Hilos32 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Usuario Núcleo Hardware Biblioteca de hilos Hilo a nivel de usuario Hilo del núcleo Proceso ligero Procesador LL L LL L L L L L P P P P P P Proceso 1 Proceso 2 Proceso 3 Proceso 4 Proceso 5 Ejemplo de la arquitectura multihilo de Solaris
  • 33. Hilos33 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Gestión de hilos básica Un hilo tiene : • Un identificador (ID) • Una pila • Una prioridad de ejecución • Una dirección de inicio de ejecución.
  • 34. Hilos34 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Gestión de hilos básica (POSIX) Se dice que un hilo es dinámico si se puede crear en cualquier instante durante la ejecución. En POSIX : • los hilos se crean dinámicamente con la función pthread_create. • pthread_exit termina el hilo que la invoca.
  • 35. Hilos35 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Gestión de hilos básica (POSIX), ejemplo: Programa que crea un hilo donde muestra el mensaje “Hola Mundo” Para compilar el programa : • $ cc -D_REENTRANT thread2.c -o thread2 -lpthread
  • 36. Hilos36 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. int main() { pthread_create(a_thread,funcion_hilo); pthread_join(a_thread); } funcion_hilo() { … } Crea un hilo nuevo Espera a que termine el hilo creado Hilo principal Hilo creado con la llamada pthread_create
  • 37. Hilos37 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Gestión de hilos básica (POSIX) Pthread_join() • Hilo que ejecuta pthread_join, espera a que termine otro hilo El hilo principal debe esperar a que terminen todos los hilos creados • Si el hilo principal no espera a que terminen los hilos creados, al terminar termina el proceso con todos los hilos.
  • 38. Hilos38 Copyright © 2006, Intel Corporation. All rights reserved. Sistemas Operativos Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States or other countries. *Other brands and names are the property of their respective owners. Hilos en memoria Código (compartido) Datos (compartidos) Int cont=0 (var. Global) Stack (de cada hilo) Int i (var local) Stack (de cada hilo) Int i (var local)

Editor's Notes

  1. #include <pthread.h> int pthread_create(pthread_t *tid, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg); pthread_create crea un hilo y lo coloca en la cola de hilos. tid apunta al ID del hilo que se crea. Los atributos del hilo se encapsulan en el objeto atributo al que apunta attr si este es null, el nuevo hilo tendrá los atributos por omisión. start_routine, es el nombre de una rutina a la que el hilo invoca. El parámetro que se le especifica a start_routine es arg. #include <pthread.h> void pthread_exit(void *value_ptr); La función pthread_exit termina el hilo que la invoca. El valor del parámetro value_ptr queda disponible para pthread_join.
  2. #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <pthread.h> void *thread_function(void *arg); char message[] = "Hola mundo"; int main() { int res; pthread_t a_thread; void *thread_result; /* Aquí se crea el hilo */ res = pthread_create(&a_thread, NULL, thread_function, (void *)message); if (res != 0) { perror("Thread creation failed"); exit(EXIT_FAILURE); } printf("Esperando que el hilo termine...\n"); res = pthread_join(a_thread, &thread_result); if (res != 0) { perror("La unión del hilo ha fallado"); exit(EXIT_FAILURE); } printf("Hilo unido, regresó %s\n", (char *)thread_result); printf("El mensaje es %s\n", message); exit(EXIT_SUCCESS); } void *thread_function(void *arg) { printf("la función del hilo está corriendo. El Argumento fué %s\n", (char *) arg); sleep(3); strcpy(message, "Adios!"); pthread_exit("Gracias por el tiempo del CPU"); }
  3. #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <pthread.h> // Definen funciones para manejo de hilos void *thread_function(void *arg); // Función donde inicia el hilo int cont=0; // Es la misma para ambos hilos // Global está en el segmento de datos int main() { // Definición de variables int res; pthread_t a_thread; // Identificador del hilo void *thread_result; int i; // Es local, por lo tanto está en el segmento de stack de cada hilo /* Aquí se crea el hilo */ res = pthread_create(&a_thread, NULL, thread_function,NULL); if (res != 0) { perror("Thread creation failed"); exit(EXIT_FAILURE); } // Hilo principal for(i=1;i<=10;i++) { printf("%d\n",i); cont++; printf("Hilo principal dice cont=%d\n",cont); sleep(1); } printf("Esperando que el hilo termine...\n"); // Esperar a que termine el hilo cuyo identificador es a_thread res = pthread_join(a_thread, &thread_result); if (res != 0) { perror("La unión del hilo ha fallado"); exit(EXIT_FAILURE); } printf("Hilo unido, regresó %s\n", (char *)thread_result); exit(EXIT_SUCCESS); } // Función donde inicia la ejecución el hilo secundario void *thread_function(void *arg) { int i; // Es local, por lo tanto está en el segmento de stack de cada hilo for(i=10;i>0;i--) { printf("%d\n",i); printf("Hilo secundario dice cont=%d\n",cont); sleep(1); } pthread_exit("Gracias por el tiempo del CPU"); }