CHAPTER 16
Multi-threading
What is a thread? A thread executes a sequence of steps. The code in a method defines a series of actions. A thread executes the statements in a method sequentially. A thread is a sequence of execution. The statements in a method define a sequence of execution. A thread executes statements in a method one by one. Some of the statements being executed result in invocation of another method or constructor.
Every thread has a task, which it is executing. The task for a thread is defined in a method, which it is supposed to finish. What is required by a thread for executing the task (method)? In Java a thread uses a runtime stack to carry out its task. Initially the runtime stack is loaded with the method (frame is created) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access