15.05.2013 Views

Clase Thread - docencia de la ETSIT-URJC

Clase Thread - docencia de la ETSIT-URJC

Clase Thread - docencia de la ETSIT-URJC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Introducción<br />

Un thread está compuesto por:<br />

• Código que ejecuta el thread<br />

• Datos que consulta/modifica el thread<br />

• Prioridad <strong>de</strong>l thread: utilizada para que el p<strong>la</strong>nificador <strong>de</strong>cida qué thread ejecutar<br />

cuando hay varios posibles<br />

Cómo se implementan los threads<br />

• Cuando se interrumpe <strong>la</strong> ejecución <strong>de</strong> un thread se salva el contador <strong>de</strong> programa, los<br />

registros y su pi<strong>la</strong> para po<strong>de</strong>r recuperar su estado cuando se continúe su ejecución<br />

• Pue<strong>de</strong> haber un thread por procesador en máquinas multiprocesadoras, o un thread<br />

por cada proceso <strong>de</strong>l sistema operativo (SO), o un thread por cada “proceso ligero”<br />

<strong>de</strong>l SO, o múltiples threads por cada proceso <strong>de</strong>l SO, contro<strong>la</strong>dos por un p<strong>la</strong>nificador<br />

que corre en espacio <strong>de</strong> usuario<br />

El soporte para threads lo pue<strong>de</strong> proporcionar el propio lenguaje, o una biblioteca aparte

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

Saved successfully!

Ooh no, something went wrong!