Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Oct 2008 03:35:17 -0700
From:      Jeremy Chadwick <koitsu@FreeBSD.org>
To:        Rajeshwar Patil <Rajeshwar.Patil@aricent.com>
Cc:        Ramachandran Sathyanarayanan <Ramachandran.Sathyanarayanan@aricent.com>, freebsd-questions@freebsd.org
Subject:   Re: sleep is not working to avoid starvation among threads of same priority
Message-ID:  <20081007103517.GA46537@icarus.home.lan>
In-Reply-To: <B110A82B42E4E547B2A622349609CC1E2D21B52F61@GUREXMB02.ASIAN.AD.ARICENT.COM>
References:  <B110A82B42E4E547B2A622349609CC1E2D21B52F61@GUREXMB02.ASIAN.AD.ARICENT.COM>

next in thread | previous in thread | raw e-mail | index | archive | help
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 |




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081007103517.GA46537>