Multithreading means a single program have multiple threads and execute independently at same time. Multithreading is a feature of C++ that have multiple single threads.

Thread is a light weight process of a program and these threads executing simultaneously.


• We can print a document in MS-Word at the same time checking the spelling mistakes in the document.

• We can open multiple tabs in browser.

Important terms in Multithreading –

Program: A set of instruction store in hard disk is called a program.

Process: A program in RAM is called process.

Thread: Thread is a process under the control of CPU.

Thread Life Cycle –

Thread goes through these stages in its life cycle.

• New

• Runnable

• Running

• Non- runnable

• Terminated

Threda Life Cycle

• In new state, thread instance has been created but start() is not yet invoked.

• When start() is invoked thread is in runnable state.

• After call the run() method thread is in running state.

• Waiting thread is non-runnable state , in this state the thread is alive but not eligible to run.

• In dead state, thread is not alive.Once the run method is completed then it will destroy.

Multiprogramming :

When more than one process are queued in RAM for their execution the concept is known as multiprogramming.

For Example: There are many students in queue for interview and only one student is interviewed is allow at a time, the process that is going on will be multiprogramming.


When more than one process are under execution than the concept is known as multitasking.

For Example: At a same I am using my worpad and as well as playing songs.

Multiprocessing :

When more than one processors are used in same system to solve single or multiple task than the concept is known as multiprocessing.

Program to demonstrate abstract claa with on virtual function –

#include <iostream> 
using namespace std;  
 class Vehicle    
    virtual void run()=0;    
 class Bike : Vehicle    
     void run()    
        cout << " Bike is running..." << endl;    
class Car : Vehicle    
     void run()    
        cout << "Car is running..." << endl;    
int main( ) {  
    Bike bike;  
    Car car;;;   
   return 0;  

Output –

Bike is running...
Car is running...