Linux Newbie help
 help / color / mirror / Atom feed
From: "Lee Chin" <leechin@mail.com>
To: hahn@physics.mcmaster.ca
Cc: linux-newbie@vger.kernel.org
Subject: Re: usleep
Date: Thu, 12 Jun 2003 15:43:05 -0500	[thread overview]
Message-ID: <20030612204306.7450.qmail@mail.com> (raw)

Mark,
Two questions

1) Do threads inherrit the schedule priority?  Or do I need to set this for every thread

2) If there is nothing else runnable in my system, will this help? or is it effectively the same?

Thanks
Lee
----- Original Message -----
From: Mark Hahn <hahn@physics.mcmaster.ca>
Date: Wed, 11 Jun 2003 21:02:17 -0400 (EDT)
To: Lee Chin <leechin@mail.com>
Subject: Re: usleep

> > Any way... what is setrealtime?  I dont have it on my linux machine
> 
> it's a simple tool I wrote a long time ago, code below.
> ***** N O T E *******
> it can effectively freeze your machine, since it gives you a process
> which will not be prempted!  it *is* useful, though, if you know
> what you're doing...
> ***** N O T E *******
> 
> #include <unistd.h>
> #include <stdlib.h>
> #include <stdio.h>
> #include <sched.h>
> /* setrealtime: run procs in realtime.
>    author: Mark Hahn <hahn@mcmaster.ca> */
> 
> int main(int argc, char *argv[]) {
>     static struct sched_param sched_parms;
>     int pid, wrapper=0;
> 
>     if (argc <= 1)
>         return 1;
> 
>     pid = atoi(argv[1]);
> 
>     if (!pid || argc != 2) {
>         wrapper = 1;
>         pid = getpid();
>     }
>     if (!pid)
>         return 1;
>  
>     sched_parms.sched_priority = sched_get_priority_min(SCHED_FIFO);
>     if (sched_setscheduler(pid, SCHED_FIFO, &sched_parms) == -1) {
>         perror("cannot set realtime scheduling policy");
>         return 1;
>     }
>     if (wrapper) {
>         setuid(getuid());
>         execvp(argv[1],&argv[1]);
>         perror("exec failed");
>         return 1;
>     }
>     return 0;
> }
> 

-- 
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

             reply	other threads:[~2003-06-12 20:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-12 20:43 Lee Chin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-06-12  1:04 usleep Lee Chin
2003-06-12  0:53 usleep Lee Chin
2003-06-12  1:02 ` usleep Mark Hahn
2003-06-12  0:42 usleep Lee Chin
2003-06-11 22:55 usleep Lee Chin
2003-06-11 16:08 ` usleep Alan Bort
2003-06-11 23:21 ` usleep CaT
2003-06-11 23:45 ` usleep Mark Hahn
2003-06-11 23:55 ` usleep Ray Olszewski
2003-06-12  0:17   ` usleep Mark Hahn
     [not found]   ` <Pine.LNX.4.44.0306112015380.20310-100000@coffee.psychology .mcmaster.ca>
2003-06-12  0:38     ` usleep Ray Olszewski
2003-06-11 18:45       ` usleep Alan Bort
2003-06-12  4:14       ` usleep Riley Williams
2003-06-12  7:46         ` usleep Ray Olszewski
2003-06-13  1:23   ` usleep Stephen Samuel
2003-06-12 11:47 ` usleep Steven Smith
2003-06-13  1:16 ` usleep Stephen Samuel
2003-06-13  1:22   ` usleep Mark Hahn

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20030612204306.7450.qmail@mail.com \
    --to=leechin@mail.com \
    --cc=hahn@physics.mcmaster.ca \
    --cc=linux-newbie@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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