0% found this document useful (0 votes)
51 views

Interactive Java Note - M06 - UN012 - P01

This document discusses threads and multithreading in Java programming. It defines a thread as a single, sequential flow of control within a program. There are two types of threads: single threads and multiple threads. Single-threaded applications support one thread, while multi-threaded applications support more than one thread, allowing for concurrent execution. Multitasking refers to an operating system executing more than one program simultaneously, while multithreading allows multiple parts of a single program called threads to execute simultaneously. The document outlines some uses of threads, such as increasing CPU usage and improving GUI performance.

Uploaded by

Ebby Kyle
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Interactive Java Note - M06 - UN012 - P01

This document discusses threads and multithreading in Java programming. It defines a thread as a single, sequential flow of control within a program. There are two types of threads: single threads and multiple threads. Single-threaded applications support one thread, while multi-threaded applications support more than one thread, allowing for concurrent execution. Multitasking refers to an operating system executing more than one program simultaneously, while multithreading allows multiple parts of a single program called threads to execute simultaneously. The document outlines some uses of threads, such as increasing CPU usage and improving GUI performance.

Uploaded by

Ebby Kyle
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 12

Programming Language (JAVA)

Unit 6.12 - Basics of Threading

Presentation 1

Revision

1. Define an applet and explain its lifecycle.


2. State the differences between applet and application?

3. Describe the use of graphic class.

Objectives
At the end of this presentation, you will be able to Explain the need of multitasking Recognize the concurrent execution of multithreaded applications Describe the uses of threads

Thread Definition
Thread can be defined as single, sequential flow of control within a program.

Thread Types
Are of two types
Single thread Multiple threads

Single threaded Application


A task or process that is made up of only one thread is single-thread.
A program that supports single thread is called single threaded application.

Multi-threaded Application
A task or process that is made of more than one thread is multiple threading.
A program that supports more than one thread is multi-threaded application

Multi-tasking
Is the ability of an operating system to execute more than one program simultaneously.

Difference Between Multitasking and Multithreading


S.No: 1. Multitasking More than one program gets executed simultaneously. Multithreading More than one part of a program called threads is executed simultaneously. Multithreading is also a timesharing process. CPU switches from one activity to another activity within the program so quickly to complete all the activities simultaneously. Multithreading is a light weight process because the activities/ threads share the same memory space.

2.

Multitasking is a timesharing process. CPU switches from one program to another program so quickly to complete all the programs simultaneously. Since each program occupies different memory location, Multitasking is called as heavyweight process

3.

Uses of Threads
A program can be split into separate tasks and further into threads. This increases the effective usage of CPU during execution.
The popularity of threading increased with Graphical User Interfaces. Threading system allowed the user to attain better performance in a program.

The introduction of threads created an illusion that the program's performance was faster.

Importance of Threads
In a Java program, one thread need not wait for another thread to complete. This is called asynchronous behaviour of threads.
Java provides few techniques to handle the asynchronous behaviour of threads. Minimise the CPU's idle time.

Summary
In this presentation, you learnt the following Threads can be defined as single, sequential flow of control within a program.

The two types of threads are single and multiple threads


A program that supports single thread is single threaded application.

A program that supports more than one thread is multi-threaded application.


Multi-Tasking is the ability of an operating system to execute more than one program simultaneously.

You might also like