Presiding Officer Training module 2024 lok sabha elections
Multiprocessing in python
1.
2. Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
4. Jobs Applied
#
Company
1
aerosoft corp
2
aufait technologies
3
Admin-Ahead Server
Technologies
Designation
Current
Status
03/09/13
Php developer
Applied Date
waiting
03/09/13
waiting
03/09/13
waiting
6. Introduction
What is a process?
●
●
●
●
A process is an instance of a computer program that is being
executed.
It contains the program code and its current activity
process
Depending on the operating system (OS), a process may be
made up of multiple threads of execution that execute
instructions concurrently
In fact only one process can be executing at any one time on a
single-core CPU (unless using multithreading or other similar
technology).
7. Multiprocessing
●
●
Multiprocessing is the use of two or more central processing units(CPUs)
within a single computer system
The term also refers to the ability of a system to support more than one
processor and/or the ability to allocate tasks between them.
8. Python Multiprocessing:
●
●
●
●
As CPU manufacturers start adding more and more cores to their
processors, creating parallel code is a great way to improve performance.
There are a lot of options out there for parallel development (such as
functional languages or developer toolkits).
Along with the release of Python 2.6 came a new module called
multiprocessing
The multiprocessing module lets you write parallelized code using
processes in relatively simple code
9. Processes, Queues and
Locks:
● The multiprocessing module comes with plenty of built-in options for building
a parallel application
●
Three most basic (and safest) are the Process, Queue and Lock classes
Processes:
●
The Process is an abstraction that sets up another (Python) process, provides it
code to run and a way for the parent application to control execution
from multiprocessing import Process#import the Process class
def say_hello(name='world'):#create a function the process will run
print "Hello, %s" % name
p = Process(target=say_hello)#instantiate a Process object with the
function it should run
p.start()#The process will run and return it's result
p.join()#process to complete via p.join()
13. If this presentation helped you, please visit our page facebook.com/baabtra and
like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
14. Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550