CS 18000 Lecture Notes - Lecture 12: Domain Decomposition Methods, Control Flow

41 views3 pages
03/07/2017
1. Compiling to Byte Code
a. Compiler “flattens” the Java code into a linear sequence of instructions that can
be executed by the Java Virtual Machine
b. Each instruction is identified by memory location
c. Control flow uses”goto” statements
2. Fetch-Execute Cycle
a. The JVM performs a “fetch-execute” cycle
b. Fetch the instruction from the “current location:” in memory
c. Update the “current location”
d. Repeat
3. Sequential vs Concurrent
a. Sequential
i. A single “thread of execution” weaves its way through your program
ii. A single PC identifies the current instruction being executed
iii. Multiple PC’s are active, one for each thread
4. Java threads
a. Thread class with run() method
b. import java.lang.*;
c. Allows creation and manipulation of threads
i. Thread t = new Thread();
d. 3 important methods
i. t.start(): start the thread referenced by t
ii. t.join(): “join with” (wait for) the running thread t
iii. t.run(): called by start() in a different thread
5. How to Create Threads
a. Create a class that implements the Runnable interface
i. Thread t = new Thread(new myTask());
Unlock document

This preview shows page 1 of the document.
Unlock all 3 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents