From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 7 11:58:54 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD067106569E for ; Tue, 7 Oct 2008 11:58:53 +0000 (UTC) (envelope-from Ramachandran.Sathyanarayanan@aricent.com) Received: from jaguar.aricent.com (jaguar.aricent.com [121.241.96.11]) by mx1.freebsd.org (Postfix) with ESMTP id 14B038FC1A for ; Tue, 7 Oct 2008 11:58:52 +0000 (UTC) (envelope-from Ramachandran.Sathyanarayanan@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 m97Bsj12027856 for ; Tue, 7 Oct 2008 17:24:45 +0530 Received: from GUREXHT01.ASIAN.AD.ARICENT.COM (gurexht01.asian.ad.aricent.com [10.203.171.136]) by jaguar.aricent.com (8.13.8/8.13.8) with ESMTP id m97BsjbQ027828 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=FAIL) for ; Tue, 7 Oct 2008 17:24:45 +0530 Received: from GUREXMB02.asian.ad.aricent.com ([10.203.171.132]) by GUREXHT01.ASIAN.AD.ARICENT.COM ([10.203.171.136]) with mapi; Tue, 7 Oct 2008 17:28:48 +0530 From: Ramachandran Sathyanarayanan To: "freebsd-hackers@freebsd.org" Date: Tue, 7 Oct 2008 17:28:47 +0530 Thread-Topic: sleep is not working to avoid starvation among threads of same priority Thread-Index: AckoZFjwx1hc0ptOQfe07GpuldRJxQABEJqAAALY7EA= 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 Subject: sleep is not working to avoid starvation among threads of same priority X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2008 11:58:54 -0000 Hi I hope this is the right mailer for this question. pls let us know your in= puts on this. Thanks Ram ________________________________ From: Rajeshwar Patil Sent: Tuesday, October 07, 2008 3:36 PM To: freebsd-questions@freebsd.org Cc: Ramachandran Sathyanarayanan; Rajeshwar Patil Subject: sleep is not working to avoid starvation among threads of same pri= ority 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."