First page Back Continue Last page Overview Image

FSM of the main thread

RUNNING

TERMINATING

KILLING

PDEATH

if program’s state is ZOMBIE

program’s state = END

New state = RUNNING

TDEATH

Send TERM to all the threads if any

Send TERM to all the programs if any

Stop stats timer if started

if running threads or programs

Arm the guard timer (TERM_TO)

New state = TERMINATING

else

Print statistics summary

New state = END

STATS_TO

Print per-thread statistics

Rearm timer

New state = RUNNING

TERM

TERM

PDEATH

if program’s state is ZOMBIE

program’s state = END

If no more running programs/threads

Stop guard timer (TERM_TO)

Print statistics summary

New state = END

else

New state = TERMINATING

TDEATH

Decrement counter of running threads

If no more running programs/threads

Stop guard timer (TERM_TO)

Print statistics summary

New state = END

else

New state = TERMINATING

TERM_TO

Send KILL to all the threads if any

Send KILL to all the programs if any

if running threads or programs

Arm the guard timer (TERM_TO)

New state = KILLING

else

Print statistics summary

New state = END

TERM

PDEATH

if program’s state is ZOMBIE

program’s state = END

If no more running programs/threads

Stop guard timer (TERM_TO)

Print statistics summary

New state = END

else

New state = KILLING

TDEATH

Decrement counter of running threads

If no more running programs/threads

Stop guard timer (TERM_TO)

Print statistics summary

New state = END

else

New state = KILLING

TERM_TO

Some programs/threads do not terminate ==> Error !

END