Unix/Linux Go Back    

Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

How execute exactly one process?


Thread Tools Search this Thread Display Modes
Old Unix and Linux 08-28-2013
bacesado bacesado is offline
Registered User
Join Date: Aug 2013
Last Activity: 11 September 2013, 8:14 AM EDT
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
How execute exactly one process?

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(;Linux.???

Thank you!.
Sponsored Links
Old Unix and Linux 08-28-2013
jim mcnamara jim mcnamara is online now Forum Staff  
Join Date: Feb 2004
Last Activity: 25 September 2017, 6:26 PM EDT
Location: NM
Posts: 11,184
Thanks: 561
Thanked 1,095 Times in 1,011 Posts
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.
Sponsored Links
Old Unix and Linux 08-28-2013
alister alister is offline
Registered User
Join Date: Dec 2009
Last Activity: 11 June 2014, 8:40 PM EDT
Posts: 3,231
Thanks: 179
Thanked 976 Times in 790 Posts
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).

Old Unix and Linux 08-29-2013
bacesado bacesado is offline
Registered User
Join Date: Aug 2013
Last Activity: 11 September 2013, 8:14 AM EDT
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How OS loads process in memory to execute ? ashokd001 UNIX for Advanced & Expert Users 1 03-05-2010 07:36 AM
script to monitor process running on server and posting a mail if any process is dead pradeepmacha Shell Programming and Scripting 13 03-06-2009 06:33 AM
To execute next UNIX command after ending SFTP process. gautamc Shell Programming and Scripting 3 03-20-2008 07:49 PM
script execute or no execute Kespinoza97 Shell Programming and Scripting 4 06-23-2007 09:27 AM
Need to execute 2 scripts, wait, execute 2 more wait, till end of file halo98 Shell Programming and Scripting 1 08-01-2006 04:42 PM

All times are GMT -4. The time now is 06:29 PM.