Hi everyone , i'm working with extremely precision timers in a project but i cant get all the precision that i need 'cause the scheduler and other processes use the processor at "the same time" (multiplexing) and 1ms isn't a 1ms is more or less 1ms . There is some way to execute only a process and block all the machine until the program finish without use of for(;;).???
Thank you!.
Bye!
This can be a terrible idea, but this is how you do it.
Logon as root. Then try to set your process to a very high priority, thus avoiding the scheduler.
One way is -- Use the nice command as a workaround. Also: in Linux there are ways to create realtime priority classes for processes. To determine the highest realtime priority you can set programmatically, make use of the sched_get_priority_max function. Also be aware: MAX_USER_RT_PRIO is the priority user space should ever run in. Period. See sched.h
On Linux 2.6.32 a call to sched_get_priority_max(SCHED_FIFO) returns 99.
Consider reading this
Real-Time Linux Kernel Scheduler | Linux Journal
nice Example:
Login to root
a=( nice -19 && ./myprocess)
Logout of root.
If timing is such a big deal you should consider synchronization primitives: mutexes, semaphores, locking.
If your code is running as root you can use the nice() syscall to accomplish priority changes as well.
Note: If your process is having a problem it can bring the whole system to its knees.
Since you do not seem to know about process priority I would suggest that other mechanisms be tried first, before nice(). Meaning: Because you are asking this question, it would appear you may not be experienced enough to do realtime coding.
If 1 millisecond is critical to the task, perhaps it would be wise to hire someone with hard real-time operating system competency.
If you truly need to run just one process, DOS (I know, sounds like a joke).
Regards,
Alister
Thanks everyone , and yes DOS is an option but not now haha.
Ok jim mcnamara , you are right when you say that i'm not a experience person in real time programs , in fact this is my first time. But I'm a little bit confused , always I though that semaphores , locks and mutexes are usefull only in programs for condition races . How can i use them for realtime programs?
Thanks for the link I'm gonna to read it.
Bye