Skip to content

[QUESTION] Concurrent read/write from multiple threads #309

Answered by swamper123
devaale asked this question in Q&A
Discussion options

You must be logged in to vote

Basically I have multiple threads working as "mini-services" in my program

Remember, Python has a GIL! They are scheduled by the OS in this case!

What's the best and most importantly fastest (speed wise) implementation of trying to write/read data from multiple threads at the same time?

Since the GIL is in your way, I would use async requests (I would use asyncio for such purposes). One Snap7 Client can just handle one request at the time. Even the async once! So it wouldn't make a difference of the amount of messages. What would improve with async stuff is, that you can do something else in the meantime, until an answer from the PLC arrives (and not wait in IDLE until something happe…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by devaale
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #307 on September 07, 2021 14:14.