paint-brush
Solving Producer/Consumer Problem of Concurrent Programming in Pythonby@melvinkcx2
548 reads
548 reads

Solving Producer/Consumer Problem of Concurrent Programming in Python

by Melvin Koh7mNovember 23rd, 2019
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The Producer/Consumer problem is a common problem in concurrent programming with Python. In a producer/consumer problem, it is best to use a concurrency control object: Lock, Mutex, Semaphore, etc. In Python, a semaphore is a variable used to control access to a critical section in a multi-processing environment. In our fast-food chain scenario, consumers wait to acquire a semphore to sleep while waiting for an event. This is a much better solution than using a Lock or Mutex.

Company Mentioned

Mention Thumbnail
featured image - Solving Producer/Consumer Problem of Concurrent Programming in Python
Melvin Koh HackerNoon profile picture
Melvin Koh

Melvin Koh

@melvinkcx2

Software Engineer | Maintainer of fastapi-events

About @melvinkcx2
LEARN MORE ABOUT @MELVINKCX2'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Melvin Koh HackerNoon profile picture
Melvin Koh@melvinkcx2
Software Engineer | Maintainer of fastapi-events

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Also published here