archive mirror
 help / color / mirror / Atom feed
From: Guillaume Chazarain <>
To: Con Kolivas <>
Subject: Re: [PATCH] O9int for interactivity
Date: Sun, 27 Jul 2003 17:00:17 +0200	[thread overview]
Message-ID: <YWZVOVR72A8A5FQN7586LHRMFDLIW.3f23e901@monpc> (raw)
In-Reply-To: <>

27/07/03 03:57:19, Con Kolivas <> wrote:

>On Sun, 27 Jul 2003 07:20, Guillaume Chazarain wrote:
>> Hi Con,
>> Strange your activate() function in O9. Isn't it?
>> It doesn't care that much about sleep_time.
>> So here is a very simple trouble maker.
>Yes I know it's a way to make something fairly cpu intensive remain 
>interactive. However since it sleeps long enough (2ms at 1000Hz is just 
>enough), it doesn't bring the machine to a standstill, and is easily 
>killable. I doubt it is worth working around this, but I'm open to your 
>comments about variations on this theme that might be a problem.

The previous code was a mistake. (Calling clock() before sleeping is quite dumb...)
Here is another one.  If you put the right value in MHZ, (maybe more, maybe less, I dunno),
I bet you won't get out without power cycling your box...

#include <unistd.h>

#define MHZ 450 /* Your CPU Mhz */
#define COUNT (MHZ * 1000)

#define PRIO_LEVELS 10

int main(void)
    int i;


    /* Climb all priority levels. */
    for (i = 0; i < PRIO_LEVELS; i++)

    for (;;) {
        usleep(1); /* get one point. */
        for (i = 0; i < COUNT; i++); /* lose one point. */

    return 0;


  reply	other threads:[~2003-07-27 14:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-26 21:20 [PATCH] O9int for interactivity Guillaume Chazarain
2003-07-27  1:57 ` Con Kolivas
2003-07-27 15:00   ` Guillaume Chazarain [this message]
2003-07-27 15:09     ` Con Kolivas
  -- strict thread matches above, loose matches on Subject: below --
2003-07-26 17:06 Con Kolivas
2003-07-26 18:17 ` Felipe Alfaro Solana
2003-07-26 18:32   ` Wiktor Wodecki
2003-07-26 18:39     ` Andrew Morton
2003-07-27  0:08   ` Con Kolivas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YWZVOVR72A8A5FQN7586LHRMFDLIW.3f23e901@monpc \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).