sleep is not working to avoid starvation among threads of same
priority
Jeremy Chadwick
koitsu at FreeBSD.org
Tue Oct 7 10:35:18 UTC 2008
On Tue, Oct 07, 2008 at 03:34:41PM +0530, Rajeshwar Patil wrote:
> I have two threads of same priority lets say thread A and thread B,
> thread A is starving since thread B has got a for loop of size 100k.
> So, to avoid starvation I am processing 1000 iterations of for
> loop(that of thread B) in one batch and giving sleep of 1ms, but still
> thread A is starving. If I increase the batch size used in for loop
> from 1k to 10k then starvation of thread A is little less whereas it
> should be more as Im increasing processing time of thread B. I tried
> various combinations of sleeps and batches, but I couldnt solve the
> starvation of thread A.
>
> Is the sleep right solution?
>
> I will be grateful if someone could answer on this.
This might be a question for freebsd-hackers, which is more
developer-oriented than -questions.
--
| Jeremy Chadwick jdc at parodius.com |
| Parodius Networking http://www.parodius.com/ |
| UNIX Systems Administrator Mountain View, CA, USA |
| Making life hard for others since 1977. PGP: 4BD6C0CB |
More information about the freebsd-questions
mailing list