An Introduction to Multi-Threading. I thought we'd open up the boxes for a while just to see what these two mean. Sit back, take a coffee, and lets fire up those neurons.
A post or so ago, we had a discussion on the differences between multi-threading and multi-processing, this being a result of IronPython's feature to allow multi-threaded code to use multi-core processors. So in this article, I thought we'd open up the boxes for a while just to see what these two mean. Sit back, take a coffee, and lets fire up those neurons.
Now, for an understanding of the concepts, we should differentiate between a process and a thread.
Say I write a program:
sample_prog.py. Once I ran this and let it do what it does best, I have created an instance of the program. In definition, this is a process.
To break this even further, if my program
sample_prog.pywas, say, taking multiple files, editing the title of these files, and moving them in a different directory once processed, I would have broken the process down to threads. In this case, I have two threads:
Don't get it wrong, this is the same program instance(also called process) doing different things.
If we were to come back to something closer to home, you have opened a tab on Hacker Noon right now, while at the same time, I assume, have another tab open locked into your favourite ecommerce site.
In this case, you have one program running, your Firefox browser as a program (Of course, it's not Internet explorer open, is it?); this is the instance, that is, a process.
With this process, you have two tabs, in essence, two threads of the same process.
Calculate Memory Consumption of Python Code - Python developers should be aware about the memory consumption of the code they are writing.This will help in multiple ways.Be it deciding…
Guide to Python Programming Language
This article will explore how to generate QR code in Python and some useful creation features from pyqrcode library. QR codes recently became more popular than ever before, yet few people know that the first iterations of QR codes were created back in 1990s in Japan for the automotive industry.
Python is an interpreted, high-level, powerful general-purpose programming language. You may ask, Python’s a snake right? and Why is this programming language named after it?
Python Hello World Program - Your first step towards Python world. Learn how to create the Hello World Python program in PyCharm.