[chuck-users] implementing a "wait for signal with timeout"

Hans Aberg haberg at math.su.se
Wed Jun 10 10:54:07 EDT 2009


On 10 Jun 2009, at 16:14, mike clemow wrote:

> Linux 2.6 w/ realtime-patched kernel.  I run a cluster of headless AMD
> Athlon machines with ChucK on each.  Each machine only has 256mb of
> RAM, however, and I'm not surprised about the fact that ChucK can use
> it all.  When it happens, the machine starts spewing error messages to
> the console (which I never saw until I looked at the output of the
> monitor--i usually login via ssh), which prevents me from logging in
> and killing the process.  It also prevents me from logging in via ssh.
> I want to send some of this output, which specifically mentions the
> process named "chuck" and un-reclaimable memory, to you folks, but
> it's going to be difficult to capture.
>
> I wonder if there's a way to specify a memory quota for a process in
> Linux.  If it tries to use more, it gets killed by the OS...  I'm
> speculating here.

Yes, ulimit. It is tied to the shell. The stuff below is form 'man  
bash'. If you do not specify -S it sets a hard limit which can only be  
adjusted downwards. So -v -s and -d might be to set (in 1 kb  
increments).

   Hans


----
ulimit[−SHacdefilmnpqrstuvx[limit]]
Provides control overthe resources available to the shell and to  
processes started by it, on systems
that allowsuch control. The−Hand−Soptions specify that the hard or  
soft limit is set for the
givenresource. Ahard limit cannot be increased once it is set; a soft  
limit may be increased up to
the value of the hard limit. If neither−Hnor−Sis specified, both  
the soft and hard limits are set.
The value oflimit can be a number in the unit specified for the  
resource or one of the special val-
ueshard, soft, orunlimited, which stand for the current hard limit,  
the current soft limit, and no
limit, respectively. Iflimit is omitted, the current value of the soft  
limit of the resource is printed,
unless the−Hoption is given. Whenmore than one resource is  
specified, the limit name and unit
are printed before the value. Otheroptions are interpreted as follows:
−a All current limits are reported
−c The maximum size of core files created
−d The maximum size of a process’sdata segment
−e The maximum scheduling priority ("nice")
−f The maximum size of files written by the shell and its children
−i The maximum number of pending signals
−l The maximum size that may be locked into memory
−m The maximum resident set size
−n The maximum number of open file descriptors (most systems do not  
allowthis value to
be set)
−p The pipe size in 512-byte blocks (this may not be set)
−q The maximum number of bytes in POSIX message queues
−r The maximum real-time scheduling priority
−s The maximum stack size
−t The maximum amount of cpu time in seconds
−u The maximum number of processes available to a single user
−v The maximum amount of virtual memory available to the shell
−x The maximum number of file locks
Iflimit is given, it is the newvalue of the specified resource (the 
−aoption is display only). If no
option is given, then−fis assumed. Values are in 1024-byte  
increments, except for−t, which is in
seconds, −p, which is in units of 512-byte blocks, and−nand−u,  
which are unscaled values. The
return status is 0 unless an invalid option or argument is supplied,  
or an error occurs while setting
anew limit.
----



More information about the chuck-users mailing list