
Domains
Artificial Intelligence
Harness AI to create smarter workflows and scalable growth.
View All Artificial Intelligence Coursesicon-aiCertifications
Certification
100+ Hours
Trending
Post Graduate Certification Program in Data Analytics and Applied AICertification
140+ Hours
Trending
Executive Post Graduate Certificate in Data Science and Applied AICertification
140+ Hours
Trending
PG Certificate in Applied Generative Engineering & LLM ApplicationsCertification
150+ Hours
Trending
PG Certificate in AI Powered Product and Design ThinkingCertification
15 Weeks
Trending
AI Masters ProgramCertification
4 Weeks
Trending
Vibe Coding 101: No-code AI ProgrammingCertification
48 Hours
Trending
Applied Agentic AI - No CodeCertification
16 Hours
Trending
Generative AI and Prompt EngineeringCertification
8 Weeks
Trending
AI-Powered Product ManagementCertification
8 Weeks
Trending
Applied Agentic AI CertificationCertification
16 Hours
Generative AI Course for Scrum MastersCertification
16 Hours
Generative AI Course for Project ManagersCertification
16 Hours
Generative AI Course for POPMCertification
16 Hours
Gen AI Course for Business AnalystsCertification
16 Hours
AI Powered Software DevelopmentCertification
16 Hours
AI-Data Analytics with Power BICertification
16 Hours
AI-Driven Digital Marketing TrainingCertification
16 Hours
Gen AI for Enterprise AgilistAdvanced Certifications
Masters
Executive Diploma
Executive Diploma in Machine Learning and AIExecutive Diploma
Executive Diploma in Data Science & Artificial Intelligence from IIITBCertification
Chief Technology Officer & AI Leadership ProgrammeMaster's Degree
Master of Science in Machine Learning & AIDual Certification
Executive Programme in Generative AI for LeadersCertification
Executive Post Graduate Programme in Applied AI and Agentic AIExecutive PG Program
IIT KGP-Executive PG Certificate in Gen AI and AgenticSelf-Learning Courses
Universal AI by MIT Open LearningAgile Management
Master Agile methodologies for efficient and timely project delivery.
View All Agile Management Coursesicon-refresh-cwCertifications
Scrum Alliance
16 Hours
Best Seller
Certified ScrumMaster (CSM) CertificationScrum Alliance
16 Hours
Best Seller
Certified Scrum Product Owner (CSPO) CertificationScaled Agile
16 Hours
Trending
Leading SAFe 6.0 CertificationScrum.org
16 Hours
Professional Scrum Master (PSM) CertificationScaled Agile
16 Hours
AI-Empowered SAFe® 6.0 Scrum MasterPMI
21 Hours
Best Seller
PMI Agile Certified Practitioner (PMI-ACP) CertificationAdvanced Certifications
Scaled Agile, Inc.
32 Hours
Recommended
Implementing SAFe 6.0 (SPC) CertificationScaled Agile, Inc.
24 Hours
AI-Empowered SAFe® 6 Release Train Engineer (RTE) CourseScaled Agile, Inc.
16 Hours
Trending
SAFe® AI-Empowered Product Owner/Product Manager (6.0)IC Agile
24 Hours
ICP Agile Certified Coaching (ICP-ACC)Scrum.org
16 Hours
Professional Scrum Product Owner I (PSPO I) TrainingMasters
32 Hours
Trending
Agile Management Master's Program32 Hours
Agile Excellence Master's ProgramOn-Demand Courses
Agile and ScrumRoles
Scrum MasterProduct OwnerSAFe AgilistAgile CoachAccreditation Bodies
Scrum AllianceScaled Agile, Inc.Scrum.orgICAgilePMITop Resources
Scrum TutorialCSM VS CSPOCSM vs PSMScrum Practice TestPO Interview QsProject Management
Gain expert skills to lead projects to success and timely completion.
View All Project Management Coursesicon-standCertifications
PMI
36 Hours
Best Seller
Project Management Professional (PMP) CertificationAxelos
32 Hours
PRINCE2 Foundation & Practitioner CertificationAxelos
16 Hours
PRINCE2 Foundation CertificationAxelos
16 Hours
PRINCE2 Practitioner CertificationPMI
23 Hours
Best Seller
Certified Associate in Project Management (CAPM)®PMI
24 Hours
Best Seller
Program Management Professional (PgMP®)PMI
24 Hours
Best Seller
Portfolio Management Professional (PfMP)®PMI
30 Hours
Best Seller
Project Management Institute-Risk Management Professional (PMI-RMP)®Skills
Change ManagementProject Management TechniquesCertified Associate in Project Management (CAPM) CertificationOracle Primavera P6 CertificationMicrosoft ProjectMasters
Job Oriented
45 Hours
Trending
Project Management Master's ProgramOn-Demand Courses
PRINCE2 Practitioner CoursePRINCE2 Foundation CourseRoles
Project ManagerProgram Management ProfessionalPortfolio Management ProfessionalAccreditation Bodies
PMIAxelosScrum AllianceTop Resources
Theories of MotivationManagement ProcessProject Manager Intvw QsWhat is PMP?PMP Practice TestCyber Security
Understand how to protect data and systems from threats or disasters.
View All Cyber Security Coursesicon-refresh-cwCertifications
CompTIA
40 Hours
Best Seller
CompTIA Security+EC-Council
40 Hours
Certified Ethical Hacker (CEH v13) CertificationISACA
40 Hours
Certified Information Systems Auditor (CISA) CertificationISACA
40 Hours
Certified Information Security Manager (CISM) Certification(ISC)²
40 Hours
Certified Information Systems Security Professional (CISSP)(ISC)²
40 Hours
Certified Cloud Security Professional (CCSP) Certification16 Hours
Certified Information Privacy Professional - Europe (CIPP-E) CertificationISACA
16 Hours
COBIT5 Foundation16 Hours
Payment Card Industry Security Standards (PCI-DSS) CertificationOn-Demand Courses
CISSPTop Resources
Laptops for IT SecurityIT Security Thesis TopicEthical Hacking Intvw QsCybersecurity in BankingBasics of CybersecurityCloud Computing
Learn to harness the cloud to deliver computing resources efficiently.
View All Cloud Computing Coursesicon-cloud-snowingCertifications
AWS
32 Hours
Best Seller
AWS Certified Solutions Architect - AssociateAWS
32 Hours
AWS Cloud Practitioner CertificationAWS
24 Hours
AWS DevOps CertificationMicrosoft
16 Hours
Azure Fundamentals CertificationMicrosoft
24 Hours
Best Seller
Azure Administrator CertificationMicrosoft
45 Hours
Recommended
Azure Data Engineer CertificationMicrosoft
32 Hours
Azure Solution Architect CertificationMicrosoft
40 Hours
Azure DevOps CertificationAWS
24 Hours
Systems Operations on AWS Certification TrainingAWS
24 Hours
Developing on AWSMasters
Job Oriented
48 Hours
New
AWS Cloud Architect Masters ProgramRoles
Cloud EngineerCloud ArchitectOn-Demand Courses
AWS Certified Developer Associate - Complete GuideAWS Certified DevOps EngineerAWS Certified Solutions Architect AssociateMicrosoft Certified Azure Data Engineer AssociateMicrosoft Azure Administrator (AZ-104) CourseAWS Certified SysOps Administrator AssociateMicrosoft Certified Azure Developer AssociateAWS Certified Cloud PractitionerAuthorized Partners of
AWSMicrosoftTop Resources
Scrum TutorialCSM VS CSPOCSM vs PSMScrum Practice TestPO Interview QsIT Service Management
Understand how to plan, design, and optimize IT services efficiently.
View All ITSM Coursesicon-git-commitCertifications
Axelos
16 Hours
New
ITIL Foundation (Version 5) CertificationAxelos
16 Hours
Best Seller
ITIL 4 Foundation CertificationAxelos
8 Hours
New
ITIL Foundation Bridge Course (Version 5)Axelos
16 Hours
ITIL Practitioner CertificationPeopleCert
16 Hours
ISO 14001 Foundation CertificationPeopleCert
16 Hours
ISO 20000 CertificationPeopleCert
24 Hours
ISO 27000 Foundation CertificationAxelos
24 Hours
ITIL 4 Specialist: Create, Deliver and Support TrainingAxelos
24 Hours
ITIL 4 Specialist: Drive Stakeholder Value TrainingAxelos
16 Hours
ITIL 4 Strategist Direct, Plan and Improve TrainingOn-Demand Courses
ITIL 4 Specialist: Create, Deliver and Support ExamITIL 4 Specialist: Drive Stakeholder Value (DSV) CourseITIL 4 Strategist: Direct, Plan, and ImproveITIL 4 FoundationTop Resources
ITIL Practice TestITSM Key ConceptsWhat is ITIL?Top SysAdmin SkillsTop Service-based FirmsData Science
Unlock valuable insights from data with advanced analytics.
View All Data Science Coursesicon-dataOur Courses
Data Science with PythonMachine Learning with PythonData Science with RMachine Learning with RPython for Data ScienceDeep Learning Certification TrainingNatural Language Processing (NLP)TensorFlowSQL For Data AnalyticsRoles
Data ScientistData AnalystData EngineerAI EngineerOn-Demand Courses
Data Analysis Using ExcelDeep Learning with Keras and TensorFlowDeployment of Machine Learning ModelsFundamentals of Reinforcement LearningIntroduction to Cutting-Edge AI with TransformersMachine Learning with PythonMaster Python: Advance Data Analysis with PythonMaths and Stats FoundationNatural Language Processing (NLP) with PythonPython for Data ScienceSQL for Data Analytics CoursesAI Advanced: Computer Vision for AI ProfessionalsMaster Applied Machine LearningMaster Time Series Forecasting Using PythonTop Resources
Machine Learning TutorialData Science Interview QuestionsDevOps
Automate and streamline the delivery of products and services.
View All DevOps Coursesicon-terminal-squareCertifications
DevOps Institute
16 Hours
Best Seller
DevOps Foundation CertificationCNCF
32 Hours
New
Certified Kubernetes AdministratorDevops Institute
16 Hours
Devops LeaderSkills
KubernetesDocker with KubernetesDockerJenkinsOpenstackAnsibleChefPuppetRoles
DevOps EngineerDevOps ExpertOn-Demand Courses
CI/CD with Jenkins XDevOps Using JenkinsCI-CD and DevOpsDocker & KubernetesDevOps Fundamentals Crash CourseMicrosoft Certified DevOps Engineer ExpertAnsible for Beginners: The Complete Crash CourseContainer Orchestration Using KubernetesContainerization Using DockerMaster Infrastructure Provisioning with TerraformGlobal Accreditations
DevOps InstituteTop Resources
Top DevOps ProjectsDevOps Practice TestDevOps Interview QsGit TutorialBasic Docker CommandsBI And Visualization
Understand how to transform data into actionable, measurable insights.
View All BI And Visualization Coursesicon-microscopeBI and Visualization Tools
Certification
24 Hours
Recommended
Tableau CertificationCertification
24 Hours
Data Visualization with Tableau CertificationMicrosoft
24 Hours
Best Seller
Microsoft Power BI CertificationTIBCO
36 Hours
TIBCO Spotfire TrainingCertification
30 Hours
Data Visualization with QlikView CertificationCertification
16 Hours
Sisense BI CertificationOn-Demand Courses
Data Visualization Using Tableau TrainingData Analysis Using ExcelTop Resources
Python Data Viz LibsSpotfire Interview QsTop Benefits of Power BIPower BI Dev FutureWeb Development
Learn to create user-friendly, fast, and dynamic web applications.
View All Web Development Coursesicon-codeOur Courses
ReactNode JSAngularJavascriptPHP and MySQLOn-Demand Courses
Angular TrainingBasics of Spring Core and MVCFront-End Development BootcampReact JS TrainingSpring Boot and Spring CloudMongoDB Developer CourseTop Resources
Top HTML ProjectsFED Interview QsReact Native Interview QsBlockchain
Understand how transactions and databases work in blockchain technology.
View All Blockchain Coursesicon-stop-squareBlockchain Certifications
40 Hours
Blockchain Professional Certification32 Hours
Blockchain Solutions Architect Certification32 Hours
Blockchain Security Engineer Certification24 Hours
Blockchain Quality Engineer Certification5+ Hours
Blockchain 101 CertificationOn-Demand Courses
NFT Essentials 101: A Beginner's GuideIntroduction to DeFiTop Resources
Blockchain Interview QsProgramming
Learn to code efficiently and design software that solves problems.
View All Programming Coursesicon-codeSkills
Python CertificationAdvanced Python CourseR Programming LanguageAdvanced R CourseJavaJava Deep DiveScalaAdvanced ScalaC# TrainingMicrosoft .Net FrameworkInterview Prep
Career Accelerator
3 Months
Software Engineer Interview PrepOn-Demand Courses
Data Structures and Algorithms with JavaScriptData Structures and Algorithms with Java: The Practical GuideLinux Essentials for Developers: The Complete MasterclassMaster Git and GitHubMaster Java Programming LanguageProgramming Essentials for BeginnersSoftware Engineering Fundamentals and Lifecycle (SEFLC) CourseTest-Driven Development for Java ProgrammersTypeScript: Beginner to AdvancedTop Resources
Python TutorialR Programming TutorialSpring Boot Interview QsModern operating systems are driven by powerful processors. They are known to provide multitasking capabilities. Powerful processors are likely to remain idle for long intervals of time because of comparatively lower speeds of I/O operations. Operating systems today are designed to perform multiple tasks concurrently, so as to keep processor engaged. We often see a big document being printed in the background, while another program running simultaneously. In real sense, processor performs one task at a time, but it switches between tasks so fast that multiple tasks appear to be handled simultaneously.
Thread can be considered as flow of execution of a process. The term 'multithreading' refers to occurrence of more than one simultaneous paths of execution of instructions in a single process. As any program is executed, a primary thread is said to have started running. During the run, another line of parallel execution may be initiated. It is called secondary thread. Such a program in which contains more than one flows of control is called 'multithreaded program'.
Process based multitasking involves huge overheads in terms of resources. Multithreading on the other hand is comparatively lightweight as multiple threads in a single process share same memory space. Of course a careful maneuvering of threads needs to be done to avoid 'race condition' – a situation where more than one threads trying to update data at same location.
Primary or main thread starts as soon as the program is run, and it terminates as the program ends. A secondary thread may be initiated during the execution of primary thread. Upon creation, it starts 'running' a stipulated function. As the function is over, the secondary thread merges with the primary thread.
While a thread is in running state, it may be halted, either for a specified interval or till a condition occurs, or till some other thread completes its operation. Halted thread resumes either after a specified interval or conditionally.

Earlier versions of Python contained _thread module which offered a bit primitive threading mechanism. Newer 'threading' module provides higher-level threading interfaces on top of the lower level _thread module.
As mentioned earlier, main thread is always present representing the control flow of program. Additional thread is created by declaring object of Thread class which is defined in 'threading' module.
Thread(name,target)
Although 'name' parameter is none by default, a unique name to each thread is internally assigned. You can specify it exclusively if required.
Each new thread should invoke start() method, which will in turn call run() method. Instead of run() method, if any other function is to be called by start(), it should be set as target parameter.
Following methods are defined in Thread class:
This method starts the thread’s activity. It must be called once a thread object is created. It automatically invokes object’s run() method in a separate thread. If called more than once, a RuntimeError will be raised.
This method represents the thread’s activity. It may be overriden in a subclass. Instead of standard run() method, the object invokes the function passed to the it's constructor as the target argument.
This method blocks the calling thread until the thread whose join() method is called terminates. The termination may be either normal, because of an unhandled exception – or until the optional timeout occurs. It can be called many times. The join() raises a RuntimeError if an attempt is made to join the current thread. Attempt to join() a thread before it has been started also raises the same exception.
This is a property object for getter and setter methods of thread's name attribute.
This returns name attribute of thread.
This method assigns a string as name attribute of thread object.
This method returns whether the thread is alive. It returns True just before calling run() method and until just after the run() method terminates.
Following program illustrates basic functionality of multithreading mechanism:
from threading import Thread
import time
class myThread(Thread):
def __init__(self, name):
Thread.__init__(self)
self.name=name
self.start()
def run(self):
for i in range(1,6):
time.sleep(5)
print (self.name, i)
t1=myThread('Thread1')
for i in range(1,6):
print ('main', i)
time.sleep(5)
Here, the main thread runs a for loop after creating a new thread. In each iteration there is a call to sleep() function allowing progress of main thread to pause, paving way for secondary thread to run.
The other thread is an object of a subclass of Thread class in threading module. On creating, the start() method is called upon, which in turn invokes run() method.
The run() method, overridden in myThread subclass also has a for loop which takes one iteration and pauses. By that time main thread's pause time is over. So the main and secondary threads take turns to complete one iteration of loop at a time. The output is as below:
main 1
Thread1 1
main 2
Thread1 2
main 3
Thread1 3
main 4
Thread1 4
main 5
Thread1 5
In a multithreaded program, there may be a situation more than one threads try to gain access to same resource, unpredictable result may arise. For example, if multiple threads try to perform read/write operation on same file, it may cause data inconsistency because one of the threads may change its contents before earlier thread's file closing operation hasn't been finished. Hence such a concurrent handling of shared resources such as file or function need to be synchronized in such a way that only one thread can access the resource at a given point in time.
A lock object provides a synchronization mechanism. It is not owned by a particular thread when locked. The Lock object is always in one of two states, “locked” or “unlocked”. When created itt is in the unlocked state. It has two basic methods, acquire() and release().
When the state is unlocked, this method changes the state to locked and returns immediately. The method takes an optional blocking argument. If set to False, it means do not block. If a call with blocking set to True would block, return False immediately; otherwise, set the lock to locked and return True.
The return value of this method is True if the lock is acquired successfully, False if not.
When the state is locked, this method in another thread changes it to unlocked. The release() method should only be called in the locked state. If an attempt is made to release an unlocked lock, a RuntimeError will be raised.
When the lock is locked, reset it to unlocked, and return. If any other threads are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. There is no return value of this method.
In following example, the locking mechanism is at work.
import threading, time
class myThread(threading.Thread):
def __init__(self,name):
threading.Thread.__init__(self)
self.name=name
def run(self):
lock.acquire()
syncmethod(self.name)
lock.release()
def syncmethod(threadName):
print (threadName,"has acquired lock and is running'syncmethod'")
counter=10
while counter:
time.sleep(1)
print ('..', end='')
counter=counter-1
print('\nlock released for', threadName)
lock=threading.Lock()
threads=[]
t1=myThread('Thread1')
t2=myThread('Thread2')
t1.start()
threads.append(t1)
t2.start()
threads.append(t2)
for t in threads:
t.join()
print ("end of main thread")
The program initializes two thread objects. As one of them acquires control of the lock to invoke 'syncmethod', other is kept waiting for former to release the lock. Here is the output:
Thread1 has acquired lock and is running'syncmethod'
....................
lock released for Thread1
Thread2 has acquired lock and is running'syncmethod'
....................
lock released for Thread2
end of main thread
This synchronization is mechanism invented by Edsger W. Dijkstra. Python implements semaphore by an internal counter which is decremented by each acquire() call and incremented by each release() call. The counter can never go below zero; when acquire() finds that it is zero, it blocks, waiting until some other thread calls release().
The threading module also defines following static functions and constants:
It returns the number of Thread objects currently alive.
It return the current Thread object, corresponding to the caller’s thread of control.
It returns a list of all Thread objects currently alive including the main thread. It excludes terminated threads and threads that have not yet been started.
it returns the main Thread object. In normal conditions, the main thread is the thread from which the Python interpreter was started.
Set a trace function for all threads started from the threading module. The func will be passed to sys.settrace() for each thread, before its run() method is called.
Set a profile function for all threads started from the threading module. The func will be passed to sys.setprofile() for each thread, before its run() method is called.
It returns the thread stack size used when creating new threads.
This module also defines the following constant:
The maximum value allowed for the timeout parameter of blocking functions like Lock.acquire(),