Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

NotificationsYou must be signed in to change notification settings

ltd-ARYAN-pvt/Introduction-to-Parallel-Processing-and-Asynchronous-Programming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

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.

Folder Structure

Asynchronous Programming/│├── 1) Multithreading/│   ├── basics/|   ├── project/│   └── README.md│├── 2) Multi-core Processing/│   ├── basics/│   └── README.md│├── 3) Asyncio/│   ├── basics/│   ├── project/│   └── README.md/│└── README.md

Overview of Techniques

  1. 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).

  2. Multi-core Processing
    Take advantage of multiple CPU cores to distribute CPU-bound tasks, like heavy computations, across multiple processors.

  3. Asyncio
    Master event-driven programming using theasyncio library in Python to handle I/O-bound tasks asynchronously and improve the responsiveness of your application.

Getting Started

  1. Clone the repository

    git clone https://github.com/ltd-ARYAN-pvt/Introduction-to-Parallel-Processing-and-Asynchronous-Programming.git
  2. 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
  3. Install dependencies
    Ayncio project example requires additional Python libraries. Navigate to the project folder and install required packages:

    pip install aiohttp

Folder Details

1) Multithreading

  • 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.

2) Multi-core Processing

  • 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.

3) Asyncio

  • 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.

Example Usage

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())

Running a Project

To run a specific project, navigate to the respective folder, follow the instructions provided in the project’sREADME.md, and execute the Python scripts.

Contribution Guidelines

Contributions are welcome! If you’d like to add more examples or projects:

  1. Fork the repository.
  2. Create a new branch.
  3. Make your changes.
  4. Open a pull request.

Feel free to open issues if you encounter any problems or have questions!

License

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp