Basic HTML version of Foils prepared 18 May 97

Foil 16 Introduction to Threads

From Java Tutorial - Spring 1997 Part 3:Graphics and the Abstract Windowing Toolkit Peking Tutorial, Web Certificate -- Spring-Summer 1997. by Nancy J. McCracken,Geoffrey C. Fox


1 A thread is a single sequential flow of control within a process.
2 If a process has more than one thread, then each thread executes concurrently.
3 Any Java applet which has extensive execution or loops to repaint the window must run as a concurrent thread with the browser window.
4 To make an applet with a thread, which is almost always recommended:
  • Change your applet definition to add "implements Runnable", the interface for threads.
  • Include an instance variable for the thread of your applet.
  • Have a start() method which creates a thread and starts it running and a stop() method which stops it running.
  • Have a run() method containing the body of your applet code.

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Thu Jan 8 1998