Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

programming in non-page-faults

Status
Not open for further replies.

Ox258

Programmer
Apr 18, 2001
5
0
0
US
For some software I'm working on, I need to make sure it doesn't slow down at any time, and taking out the ability of the system to put the program threads to disk and later page fault and reload them would make it possibly too slow. This is a real-time system so this is something I must do, but something I can't find enough information anywhere to program in.

Any help with this or a point in the right direction would be much appreciated.

Thanks,
Tony
 
I just heard about something called mlock() if anyone has used this before.

Tony
 
Ok, I have done a #include <sys/mman.h> and I did a mlockall(MCL_CURRENT | MCL_FUTURE ) to ensure that this process's current and future(stack, etc) memory is protected from page faulting. This process does a pipe to make sure it is the only version running, then does a fork() to detach from the terminal to work correctly, then kicks off 6 other threads. Could I do this mlockall() some way so the other threads do the same, or somehow the threads inherit automatically, or I do have to declare mlockall() in each of the threads, if anyone knows?

Tony
 
Just disable swap space on the machine, and make sure it has enough memory to run your program.
Disclaimer:
Beware: Studies have shown that research causes cancer in lab rats.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top