From owner-freebsd-questions@FreeBSD.ORG Tue Oct 7 10:33:00 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CEE61065688 for ; Tue, 7 Oct 2008 10:33:00 +0000 (UTC) (envelope-from Rajeshwar.Patil@aricent.com) Received: from jaguar.aricent.com (jaguar.aricent.com [125.21.164.247]) by mx1.freebsd.org (Postfix) with ESMTP id B9AB68FC15 for ; Tue, 7 Oct 2008 10:32:59 +0000 (UTC) (envelope-from Rajeshwar.Patil@aricent.com) Received: from jaguar.aricent.com (localhost [127.0.0.1]) by jaguar.aricent.com (8.13.8/8.13.8) with ESMTP id m97A2LSX003293 for ; Tue, 7 Oct 2008 15:32:21 +0530 Received: from GUREXHT02.ASIAN.AD.ARICENT.COM (gurexht02.asian.ad.aricent.com [10.203.171.138]) by jaguar.aricent.com (8.13.8/8.13.8) with ESMTP id m97A2L50003211 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=FAIL) for ; Tue, 7 Oct 2008 15:32:21 +0530 Received: from GUREXMB02.asian.ad.aricent.com ([10.203.171.132]) by GUREXHT02.ASIAN.AD.ARICENT.COM ([10.203.171.138]) with mapi; Tue, 7 Oct 2008 15:36:21 +0530 From: Rajeshwar Patil To: "freebsd-questions@freebsd.org" Date: Tue, 7 Oct 2008 15:36:21 +0530 Thread-Topic: sleep is not working to avoid starvation among threads of same priority Thread-Index: AckoZFjwx1hc0ptOQfe07GpuldRJxQ== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Rajeshwar Patil , Ramachandran Sathyanarayanan Subject: sleep is not working to avoid starvation among threads of same priority X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2008 10:33:00 -0000 Hi, 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 in= crease the batch size used in for loop from 1k to 10k then starvation of th= read 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. Thanks Rajeshwar ________________________________ "DISCLAIMER: This message is proprietary to Aricent and is intended solely = for the use of the individual to whom it is addressed. It may contain privi= leged or confidential information and should not be circulated or used for = any purpose other than for what it is intended. If you have received this m= essage in error,please notify the originator immediately. If you are not th= e intended recipient, you are notified that you are strictly prohibited fro= m using, copying, altering, or disclosing the contents of this message. Ari= cent accepts no responsibility for loss or damage arising from the use of t= he information transmitted by this email including damage from virus."