MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology

C++ language

Multi Threading in C++
Previous Home Next

Multithreading is the ability of a program or an operating system process to manage its use by more than one user at a time and to even manage multiple requests by the same user without having multiple copies of the programming running in the computer.

On a single processor, multithreading is generally implemented by time-division multiplexing (as in multitasking), and the central processing unit (CPU) switches between different software threads.

With multithreading you are able to run multiple blocks of independent code (functions) parallel with your main() function. Consider a thread a function running independent and simultaneous with the rest of your code, and therefore not interfering with the the execution order of your 'main' program. Initially, all C++ programs contain a single, default thread. All other threads must be explicitly created by the programmer

simple program for serial coded

#include <iostream>
extern "C"
 {
    #include <unistd.h>
 }
using namespace std;
void function1();
void function2();
int main()
{
function1();
function2();
return 0;
}
void function1()
{
    cout << "hello..." << endl ;
    sleep(2); // sleep method is used for sleep for 2 second
}
void function2()
{
    cout << " ....world" << endl ;
}
Previous Home Next