0

I have many doubts about design a simply python program.. I have opened a socket from a server that stream data via simply telnet server. I have 3 type of strings that begins with RED,BLUE,YELLOW and after that string the data, example:

RED 21763;22;321321

BLUE 1;32132;3432

BLUE 1222;332;3

YELLOW 1;32132;3432

I would split data in three objects, like queue, and then fork three process to elaborate this data in parallel meanwhile they arrive to socket in a sort of very basic realtime computation of these data. So to achive my goal shoud use thread/fork process and objects like queues for interprocess comunications? Or there is any different kind of approch that could I use? I'm don't known anything about multithreading programming :) Thanks for helping.

egariM
  • 175
  • 3
  • 13

1 Answers1

0

This should give you a brief idea of threads vs fork.

Creation of threads require lot less overhead. I would go with the thread architecture. Each of the three thread functions will be supplied with the respective queue on which it needs to do the realtime computation. Use of synchronization and mutual exclusion mechanisms will prevent unexpected behaviors. You can also use valgrind with drd for debugging your multithreaded program.

Community
  • 1
  • 1
Sriharsha Madala
  • 275
  • 3
  • 10