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

Create successful ePaper yourself

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

<strong>Thread</strong>s en Java<br />

P<strong>la</strong>nificación <strong>de</strong> threads<br />

• Cada thread tiene su prioridad<br />

• Si hay más threads que procesadores en el or<strong>de</strong>nador, se elige el<br />

thread que se ejecutará según su prioridad<br />

2 posibilida<strong>de</strong>s, <strong>de</strong>pendientes <strong>de</strong> <strong>la</strong> implementación:<br />

Política expulsiva: cada cierto tiempo se le quita el procesador al<br />

thread que lo tiene<br />

Política no expulsiva: hasta que no se bloquea un thread no se le<br />

quita el procesador<br />

Ejecución periódica <strong>de</strong> threads<br />

• El método sleep (n) suspen<strong>de</strong> <strong>la</strong> ejecución <strong>de</strong>l thread durante al<br />

menos n milisegundos

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

Saved successfully!

Ooh no, something went wrong!