Program:
Program is a set of instructions that execute one by one.
- For Example: In simple.java program - there are following lines.
- System.out.println("Line - 01 to run");
- System.out.println("Line - 02 to run");
- System.out.println("Line - 03 to run");
- Here, these three line will execute sequentially and display output as:
- Line - 01 to run
- Line - 02 to run
- Line - 03 to run
A process is a formation of executing.
- For Example: A program may have single or multiple processes.
- In Booting, there are main two sub-process BIOS test and POST test.
- For Example: A multiple processes may associated with a single program.
- A baby care taken or manage by Father and Mother for his/her child.
Thread is a light weight process.
- For Example: running the MS-Excel program and listening music, also.
- It is resides inside the program.
- More than one thread may associated with a single process.
- So, a process with single thread called single threaded process whereas, process with multiple thread is called Multi-threaded process.
A process with single thread is called as Single thread and a programming which is written for single thread is called as Single Thread Programming.
Example:
A process with multiple thread is called as Multi thread and a programming which is written for multi thread is called as Multi Thread Programming.
Example:
Multi-tasking:
Multitasking stand for to running multiple task at a time.
Multi-threading:
Multi-threading means a program or a process running many tasks concurrently (at the same time and parallel).
Multitasking stand for to running multiple task at a time.
- For Example: running the MS-Excel program and listening music, also.
- Multitasking is running heavyweight processes by a single OS.
Multi-threading:
Multi-threading means a program or a process running many tasks concurrently (at the same time and parallel).
- For Example: When you working in MS-Word and other tasks concurrently working such as spell checker, auto save and print and so on.
- Several multiple lightweight processes are run in a single process/task or program by a single processor.
Tags:
Java