CSE 8B Chapter Notes - Chapter 30.1-30.4: Circular Buffer

75 views3 pages

Document Summary

Multithreading enables multiple tasks in program to be executed concurrently. Program can have many tasks run concurrently. Thread == flow of execution, from beginning to end, of a task: mechanism for running task. Multithreading makes program more responsive and interactive and enhances performance ie. typing in a word document while simultaneously printing something. Java allows programmer to create additional threads to run concurrent tasks: tasks are instances of runnable interface eg runnable object. Thread == object that facilitates execution of task. Task class must implement runnable interface: must run from a thread. Runnable interface has run() run() tells how thread will run. // custom task class public class taskclass implements runnable { public taskclass() { Taskclass task = new taskclass(); // or runnable task = new taskclass(); Thread thread = new thread(task); // creates thread for task thread. start(); Thread class contains ctors for creating threads for tasks and methods for controlling threads.

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