Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #1440

Symmetric threads and fair processing of fds

Newsgroups comp.programming.threads
Date 2013-03-21 22:46 -0700
Message-ID <aff86590-d17b-4c6b-a691-f47b6f6fa285@googlegroups.com> (permalink)
Subject Symmetric threads and fair processing of fds
From itt ium <ittium@gmail.com>

Show all headers | View raw


Hi Group, 
I am developing a multithreaded software based on idea of symmetric thread suggested by  David Schwartz.
 Here all thread will run the same procedure. Thread can have following work to do
-	Handle timer message
-	Receive message from socket fd
-	Send message from send Q
-	Poll for work
We will have a shared work Q from where any thread can pick the work and start executing. If a free thread finds out, that there is no work available, it will poll for work.

While reading the data from fd, a thread will keep reading till it gets EAGAIN. 
The software runs fine when all the fds are getting similar amount of data.  When there is more data on some of the fds. Some threads are busy servicing same fd and  certain fds are not processed for long time. This leads to temporary buffer (e.g buffer used to keep message on getting EAGAIN) filling up making the system unstable. To resolve this issue I am now thinking about processing only configurable number of message whenever a (symmetric) thread picks up a work. Unfortunately, traffic on fds can not be predicted so it might takes lot of experiment to make it right for certain network conditions. Is there any other way to ensure (dynamically), symmetric threads process all the fds for fair amount of time. I will appreciate, if you can send me any discussion link, details of your previous experiences handling similar scenarios or algorithms that you might have developed for handing this scenario.
thanks
Ittium

Back to comp.programming.threads | Previous | NextNext in thread | Find similar


Thread

Symmetric threads and fair processing of fds itt ium <ittium@gmail.com> - 2013-03-21 22:46 -0700
  Re: Symmetric threads and fair processing of fds itt ium <ittium@gmail.com> - 2013-03-22 20:56 -0700

csiph-web