[lug] C program freezing machine

Bear Giles bgiles at coyotesong.com
Tue Apr 15 12:20:56 MDT 2008


Oh yeah, if you have access to the C code (or know how to write a 
wrapper) you can use setrlimit() to set some limits on system resources 
used.  You can't stop it from creating a swap storm, but you could set 
some limits to see if it's using more memory than you expected, etc.

(Sidenote: this is an oft-overlooked cheap way to add some serious 
security to your C programs.  If you know you shouldn't need to fork 
another process, set the fork count to zero.  If you know you shouldn't 
need to open any more files after the initial setup, set the open file 
limit to zero.  It's easy to bump the numbers later if you necessary.)

Bear Giles wrote:
> If it's simply IO-bound, setting a higher 'nice' value should make the 
> system more responsive.  But you're suggesting that the system is 
> totally no-responsive.
>
> My next guess would be that it's hitting the swap too hard.  Can you 
> hear if the disk is being hit?  The easiest answer is to add more 
> memory, the best answer is to review the algorithm to ensure they're 
> reasonably 'local'.  A classic example for localization is matrix 
> multiplication.  It's trivial to do it like they teach you in 
> sophomore classes, but that approach requires you to constantly access 
> the entire matrix.  Decent libraries will actually strip the data so 
> you'll only compute one submatrix at a time, but the data is small 
> enough to stay in memory (or even better, in L2 cache) and the 
> performance is much greater.
>
> gordongoldin at aim.com wrote:
>> I have a programmer with big number cruncher (probably memory 
>> intensive) programs.
>>
>> He submits his program - the machine freezes.
>>
>> What are the best items to look at first in trying to track down what 
>> could be happening.
>>
>> He is not submitting as root (so he's not filling up / by pouring 
>> junk into root home, for example).
>>
>>
>> Gordon Golding
>> ------------------------------------------------------------------------
>> Get the MapQuest Toolbar 
>> <http://www.mapquest.com/toolbar?NCID=mpqmap00030000000003>, Maps, 
>> Traffic, Directions & More!
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Web Page:  http://lug.boulder.co.us
>> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
>> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
>




More information about the LUG mailing list