Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8722257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:22:16+00:00 2026-06-13T07:22:16+00:00

I’m about to start a program using Python which is mostly doing polling, it

  • 0

I’m about to start a program using Python which is mostly doing polling, it will constantly read from the serial port (via PySerial) and read from a file descriptor which will be changing from time to time. I started looking into the threading module but then I kept finding more and more suggestions of using the multiprocessing module instead.

I’m not well versed in Python, coming from a mostly C background. What are the technical advantages of a threaded approach in Python?

In C, threads share data vs. having to set up some IPC to communicate, that seems to be the same for Python?

My usecase:

Main process (or thread?) -
   start & initialize
       |
       V
    spaw child----------------------> start & initialize
       |                                   |
       V                                   V
      while (1) <------------+          wait for data<------+
       |                     |             |                |
       V                     |             V                |
   read file descriptors     |         read from            |
       |                     |         serial port<-----+   |
       V                     |             |            |   |
   value changed?  ------No--+             V            |   |
       |                     ^        message done?--No-+   |
       V                     |             |                |
    Report change------------+             V                |
     over serial                       alert parent---------+

So I was thinking threads, since it will make sharing data got over serial easier, and they can have a shared handle to the serial port. Does this make sense, or am I thinking about this incorrectly from a Pythonic point of view?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:22:17+00:00Added an answer on June 13, 2026 at 7:22 am

    multiprocessing is mainly used in Python to avoid the GIL (Global Interpreter Lock), which stops threads being useful for trying to compute in parallel – for resource access, threads are perfect, and the better option for ease of implementation.

    The GIL means that only one thread can operate on any Python object at the same time. This means that where you are trying to speed up computations, processes will be hamstrung by the other threads. In your use case, one thread will just be checking for new input, so this won’t cause any problems at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.