Multitasking
Multithreading and Multitasking in JAVA
Overview
A process of executing multiple tasks simultaneously is known as Multitasking.
Program
package quipoin;
class Demo extends Thread {
public void run() {
System.out.println("Thread is running!!");
}
public static void main(String args[]) {
Demo t1 = new Demo(); t1.start();
}
}
Types
It is of two types:-
Process-Based Multitasking:-
•The process is a heavyweight.
•The high communication costs involved in the process.
•Each process allocates a separate memory area i.e. each process has an address in memory.
Thread-Based Multitasking:-
•Thread is a small unit of processing that operates as a lightweight sub-process..
•The cost of communication between the Thread is low.
•It uses a shared memory area, they don't allocate separate memory areas so Threads saves
memory.
•Thread is independent. If any exception occurs in one Thread it doesn't affect another thread.

Multitasking.pptx

  • 1.
  • 2.
    Overview A process ofexecuting multiple tasks simultaneously is known as Multitasking.
  • 3.
    Program package quipoin; class Demoextends Thread { public void run() { System.out.println("Thread is running!!"); } public static void main(String args[]) { Demo t1 = new Demo(); t1.start(); } }
  • 4.
    Types It is oftwo types:- Process-Based Multitasking:- •The process is a heavyweight. •The high communication costs involved in the process. •Each process allocates a separate memory area i.e. each process has an address in memory. Thread-Based Multitasking:- •Thread is a small unit of processing that operates as a lightweight sub-process.. •The cost of communication between the Thread is low. •It uses a shared memory area, they don't allocate separate memory areas so Threads saves memory. •Thread is independent. If any exception occurs in one Thread it doesn't affect another thread.