Presentation is loading. Please wait.

Presentation is loading. Please wait.

MULTITHREADING PROGRAMMING

Similar presentations


Presentation on theme: "MULTITHREADING PROGRAMMING"— Presentation transcript:

1 MULTITHREADING PROGRAMMING

2 MULTITASKING It is same as multithreading
MULTITASKING It is same as multithreading. Multitasking in java is a process of executing multiple tasks simultaneously. Multithreading and Multiprocessing both are used to achieve multitasking. In multitasking we have two methods. Process based Multitasking(Multiprogramming) Thread based Multitasking(multithreading)

3 Process based Multitasking(Multiprogramming) Each process has an address in memory . A process is a heavyweight. Cost of communication between the process is high. Thread based Multitasking(multithreading) Threads share the same address space A thread is lightweight. Cost of communication between the thread is low

4 The user can perform many operation together, so it saves time.
ADVANTAGES OF MULTITHREAD It doesn’t block the user because threads are independent. The user can perform many operation together, so it saves time. Threads are independent, so it doesn’t affect other threads.

5 SINGLE THREADED PROGRAM
Single thread used to perform only one task. A thread is a lightweight sub-process, the smallest unit of processing. class ABC { …. public void run(..) .. }

6 MULTITHREADING PROGRAMMING
Multithreading in java is a process of executing multiple threads simultaneously. Its also called as multitasking.

7 A Multithreaded Program
Main Thread start start start Thread A Thread B Thread C Threads may switch or exchange data/results

8 Threads Concept Multiple threads on multiple CPUs
Multiple threads sharing a single CPU

9 THANK YOU


Download ppt "MULTITHREADING PROGRAMMING"

Similar presentations


Ads by Google