Comp322 s12 Lec27 Slides v1
Comp322 s12 Lec27 Slides v1
Parallel Programming
Vivek Sarkar
Department of Computer Science, Rice University
[email protected]
https://wiki.rice.edu/confluence/display/PARPROG/COMP322
• Language approaches
— Habanero-Java
— Unified Parallel C
— Co-Array Fortran
— Chapel
— X10
—. . .
==> Java takes a library approach with a little bit of language support
(synchronized keyword)
HJ version
• This program uses two threads: the main thread and a HelloThread
— Each prints a greeting – the order of which is nondeterministic
• RUNNABLE
— A thread executing in the Java virtual machine is in this state.
• BLOCKED
— A thread that is blocked waiting for a monitor lock is in this state.
• WAITING
— A thread that is waiting indefinitely for another thread to perform a
particular action is in this state e.g., join()
• TIMED_WAITING
— A thread that is waiting for another thread to perform an action for up
to a specified waiting time is in this state e.g., join() with timeout
• TERMINATED
— A thread that has exited is in this state.
• The JVM shuts down when all user (non-daemon) threads terminate
— Or when shutdown is requested by System.exit, CTRL/C, signal, or other process
termination triggers