- Notifications
You must be signed in to change notification settings - Fork0
Welcome to the Asynchronous Programming repository! This repo provides a hands-on guide to mastering parallel processing concepts and techniques such as Multithreading, Multi-core Processing, and Asyncio in Python.
License
ltd-ARYAN-pvt/Introduction-to-Parallel-Processing-and-Asynchronous-Programming
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Author - Aryan Pandey
Welcome to theAsynchronous Programming repository! This repo provides a hands-on guide to mastering parallel processing concepts and techniques such asMultithreading,Multi-core Processing, andAsyncio in Python. Whether you are a beginner or an intermediate learner, this repository offers basic programming files, along with project examples, to help you dive into asynchronous programming.
Asynchronous Programming/│├── 1) Multithreading/│ ├── basics/| ├── project/│ └── README.md│├── 2) Multi-core Processing/│ ├── basics/│ └── README.md│├── 3) Asyncio/│ ├── basics/│ ├── project/│ └── README.md/│└── README.md
Multithreading
Learn how to run multiple threads concurrently, making your program more efficient when working with I/O-bound tasks (e.g., reading files, network calls).Multi-core Processing
Take advantage of multiple CPU cores to distribute CPU-bound tasks, like heavy computations, across multiple processors.Asyncio
Master event-driven programming using theasyncio
library in Python to handle I/O-bound tasks asynchronously and improve the responsiveness of your application.
Clone the repository
git clone https://github.com/ltd-ARYAN-pvt/Introduction-to-Parallel-Processing-and-Asynchronous-Programming.git
Set up the environment
Make sure you have Python installed (version 3.7+ is recommended). You may want to set up a virtual environment:python -m venv venvsource venv/bin/activate # For Linux/Macvenv\Scripts\activate # For Windows
Install dependencies
Ayncio project example requires additional Python libraries. Navigate to the project folder and install required packages:pip install aiohttp
Basics:
Includes introductory examples to help you understand the concept of threads, creating and managing threads, synchronization, and thread-safe operations.Projects:
Image Downlaoder App:- Download apps parallely frompicsum.photos
using multithreading.
Basics:
Learn how to use Python’smultiprocessing
library to run CPU-bound tasks on multiple cores.Projects:
For this i want you to try aRandom forest classifier model
and first setn_jobs=-1
and see the training speed then set it todefault
and then see the speed of training.
Basics:
Get started with asynchronous programming using Python’sasyncio
library. Learn about async functions, coroutines, tasks, and the event loop.Projects:
Image Downlaoder App:- Download apps asynchronously frompicsum.photos
usingasyncio
andaiohttp
.
Here's a simple example of usingasyncio to fetch data from multiple URLs:
importasyncioimportaiohttpasyncdeffetch(url):asyncwithaiohttp.ClientSession()assession:asyncwithsession.get(url)asresponse:returnawaitresponse.text()asyncdefmain():urls= ["https://example.com","https://python.org"]tasks= [fetch(url)forurlinurls]results=awaitasyncio.gather(*tasks)forresultinresults:print(result)asyncio.run(main())
To run a specific project, navigate to the respective folder, follow the instructions provided in the project’sREADME.md
, and execute the Python scripts.
Contributions are welcome! If you’d like to add more examples or projects:
- Fork the repository.
- Create a new branch.
- Make your changes.
- Open a pull request.
Feel free to open issues if you encounter any problems or have questions!
This project is licensed under the MIT License. See theLICENSE file for details.
About
Welcome to the Asynchronous Programming repository! This repo provides a hands-on guide to mastering parallel processing concepts and techniques such as Multithreading, Multi-core Processing, and Asyncio in Python.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.