Giter Site home page Giter Site logo

yash-occult / python-multithreading-examples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arifulhaqueuc/python-multithreading-examples

0.0 0.0 0.0 101 KB

Python Scripts on Multithreading. This repo shows us various usage of Python's threading module with different sets of requirements.

License: MIT License

Python 100.00%

python-multithreading-examples's Introduction

[this repository is under active development with a target completion time by Feb 2019]

About The Project

Topic Description
About the topic Multi-threading in Python has been recognized one of its most significant limitations. In this repository, I have tried to use Python's threading module with several scripts to show its usefulness in many diferrent forms.
Target Audience Developers who already have a good understand of Python programming (version 2.x in particular for this repo) and would like to know in details about Python's Threading module.
Purpose(s) This repository helps us understand different usage of Python's threading module with various requirements.
What to expect Practicing all given scripts would help the developers to have a very solid understanding of Python's threading module, and to get an ability to implement Python multithreaded appliation quickly and effectively.

List of Contents

  • _thread module
  • threading module
  • Extending Thread
  • Getting Current Thread Information
  • Daemon Threads
  • Joining Threads
  • Time Threads
  • Events: Communication Between Threads
  • Locking Resources
  • Limiting Concurrent Access to Resources
  • Thread-Specific Data

Pre-requisites / Know Before You Go

  • Basic knowledge of Python Multithreading module and its built-in functions
  • Good Knowledge of args, and kwargs

Knowledge Base

As we all know, in general, running multiple threads simulteneously is equivalent to running several programs at the same time. In such case, threading in Python is a very popular process to attain concurrency and parallelism. Using threading module in a Python program gives us several key advatages such as sharing same data space and operating on light-weight process in order to avoid unnecessary memory overhead.

Repository Description

All the following files are avilable in the 'script' directory.
Please note that this description section may not be fully updated as of today as I update this section once a week. You might find more scripts in the acctual application directory. Each script has a concise in-script description of the program.

File Name Difficulty Devel Description
script_1 Beginner This program Print Hello World using threading.
script_2 Beginner This program adds two given numbers and prints the result.
script_3 Beginner This program outputs default thread name when the thread is being executed.
script_4 Beginner A Timer starts its work after a delay, and can be canceled at any point within that delay time period.
script_4_1 Beginner This program prints 1 to 10 with threading module.
script_4 Beginner This program handles timer function.
script_5 Beginner This program creates five threads and each thread prints a string with a two-second interval.
script_6 Beginner This program takes a string input from user and prints the input in a text file.
script_6_1 Beginner This program runs five times and each time the program takes two numbers as given input and prints sum of them.
script_7 TBD TBD
script_8 Beginner This program creates a thread, officially names it and tries to print the name.
script_9 Beginner This program prints output of square and cube of a series of numbers.
script_10 TBD TBD
script_11 Intermediate This program tries to access the values of args and kwargs.
script_12 TBD TBD

How to run

  • clone the repo
  • set the local environment and install the dependencies
  • go to the scripts directory
  • run individual file through terminal as follows

Support & Disclaimer

Support

Found a bug??
Here are the options

  • Please file an issue with detailed description.
  • If you know a possible solution, please create a new brnach, update the code and then submit pull request.
  • If you would like to reach out to me directly with any question, email me at [email protected]

Interester in Collaboration and Contribution??
I am open to except any relevant collaboration suggestion from developers. Feel free to reach out to me in email.

General Disclaimer

This is my personal repo and not an official product of any company. If you would like to use this code, please keep it in your mind that, although I have tried to make it as error-free as possible, there's no warranty of a 100% bug free application.

Acknowledgment

This work is largely based on a number of great tutorials and resources all over the web, compiled by great people from very different domains. Without their effort and their will to make their hard work open access, i would have not been able to compile this tutorial.

References

TBD

python-multithreading-examples's People

Contributors

arifulhaqueuc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.