site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1249421974; bh=XMO60CzLEt91ZnqkXkKVk5Dr1UyRJYxaHmIVrfemU4k=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=KOV4KElXd71kefQAfCAQZqN24nJOzYmwymg4PKnxSiAwCa9vjBGAeiwSCXJNpUu+i3Co5qg7XKVTBaI66yPCbKSPu1caXTtT9mDrvvOK8b34CLdenDKxnE05DsuMJV4/YdTMrTt+h9BkWZaUYnUKuy5kFDd1a+H6eAgD7OXOl0Q= Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=vsM23mWOsxrlLwPTwU9pBEZkxmDrvJoaLeJXwFjLy5yggMd85k8vjGmVo5iYEFPaQGUgTs/RGRls77mlC5CARwTaE0Mr6aRJzOjlCZ5VzbSxN6t03upbcjP+R3TJKHU69VBsonz71G+1NfNwvEannCYKQK40bL0yyDW02cV/ya4=; Hi! So, any suggestions? Is then this a bug in the scheduler? Mike --- On Fri, 7/31/09, Mike Mimic <ppagee@yahoo.com> wrote:
From: Mike Mimic <ppagee@yahoo.com> Subject: Re: Idle priority To: "Terry Lambert" <tlambert@apple.com> Cc: "darwin-kernel@lists.apple.com" <darwin-kernel@lists.apple.com> Date: Friday, July 31, 2009, 1:54 AM Hi!
--- On Thu, 7/30/09, Terry Lambert <tlambert@apple.com> wrote:
You should probably read:
which documents the Mach scheduler interfaces.
Thanks. I have read it and improved my test program, "nice":
#include <mach/mach.h> #include <mach/thread_policy.h> #include <stdio.h>
int set_idle() { struct thread_precedence_policy policy; policy.importance = 0; // IDLE_PRI
return thread_policy_set(mach_thread_self(), THREAD_PRECEDENCE_POLICY, (thread_policy_t)&policy, THREAD_PRECEDENCE_POLICY_COUNT) == KERN_SUCCESS; }
int main(int argc, char *argv[]) { if (!set_idle()) { fprintf(stderr, "set_idle() failed\n"); return 1; }
int j; for (j = 0; ; j++) { printf("%d\n", j);
// Busy wait int i; for (i = 0; i < 100000000; i++); }
return 0; }
In documentation it is written about the importance value:
While this is a signed 32-bit value, the minimum legal value is zero (IDLE_PRI). threads set to IDLE_PRI will only execute when no other thread is scheduled to execute.
Measurements are as follows.
In the first case I got such values:
- user time - mean: 10.0282 - standard deviation: 0.0008 - real time - mean: 10.0939 - standard deviation: 0.1165
In the seconds case I got such values:
- user time - mean: 10.0285 - standard deviation: 0.0005 - real time - mean: 20.0722 - standard deviation: 0.1155
There is even bigger difference. Am I doing something wrong?
Mike
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Mike Mimic