V22.0436 - Prof. Grishman
Assignment 9 - Multi-threading
Write a small class in Java with a run
method which takes at least a few seconds to run (it doesn't matter
what it does).
Write a second small class in Java with a main method which
(See Lecture 19 notes for a model.)
- starts n parallel
threads which execute run
- executes run itself (in
the initial thread)
- waits for all threads to complete
- reports the elapsed time
Prepare a table giving the elapsed time as a function of n (n = 0, 1, 2, ...)
Try to infer from this table how many parallel threads your machine
Determine what processor your machine has, and how many concurrent
threads that processor supports. Does that information match the
results you got?
Due December 9th.
Mail your homework (the program, the table, and your observation)
and email@example.com and mark
the mail CompArch -- Asgn 9.