usleep
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 <[email protected]>
Date: Wed, 11 Jun 2003 21:02:17 -0400 (EDT)
To: Lee Chin <[email protected]>
Subject: Re: usleep
Quoted 46 lines
Quoted 1 line
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 <[email protected]> */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; }
Signature · 9 lines
__________________________________________________________ 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs