-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Original Question
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Hello Sun-managers,
>
> I have students who are learning to program using the fork()
> with while loops. The problem is they don't always get it right.
> Is there any way to limit the system resources
> so that an infinite loop with a fork won't use up all
> the VFORK resources and take the load up to 200.
> I am aware of "limit -h".
>
> cputime unlimited
> filesize unlimited
> datasize 2097148 kbytes
> stacksize 2097148 kbytes
> coredumpsize unlimited
> descriptors 1024
> memorysize unlimited
>
> If setting a hard limit is the answer, which one do
> I change and what would be an appropriate value?
> Thank you for your time.
> James O'Dell root@titan.fullerton.edu
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Answer
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The answer is in adjusting the kernel to lower the number
of prosesses a user can concurrently run. By default
this value (maxuprc) is set to 'maximum number processes - 5'.
For Solaris: to limit the number of processes a user can create to 32
Edit /etc/system
enter the line "set maxuprc=32"
reboot
(Thanks to aiden@cse.unsw.edu.au, storm@uni-paderborn.de)
For SunOS 4.1.3: to limit the number of processes a user can create to 32
Here is a script provided by nitkin@ptdcs2.intel.com
-------------------------- Cut here --------------------------
#! /bin/sh
# Note "/" changes the running kernel, "?" writes the changes to /vmunix.
/bin/cp /vmunix /vmunix.good || exit 1 # bail if the copy fails
echo "_maxuprc/W 0x20" | /bin/adb -k -w /vmunix /dev/mem
echo "_maxuprc?W 0x20" | /bin/adb -k -w /vmunix /dev/mem
sync;sync;/etc/reboot
-------------------------- Cut here --------------------------
-OR YOU CAN-
adb -w /vmunix
maxuprc?W 20
<ctrl-d>
reboot
(Thanks kent@Ranma.stanford.edu)
-OR MAYBE-
edit the systems param.c
change MAXUPRC
rebuild kernel
reboot
(Thanks grs@claircom.com)
-OR POSSIBLY-
edit /sys/sys/param.h
change "#define MAXUPRC 25"
rebuild kernel
reboot
(Thanks bwalker@planetx.portal.com)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thanks Again to the Following
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
aidan@cse.unsw.edu.au
nitkin@ptdcs2.intel.com
kent@Ranma.stanford.edu
storm@uni-paderborn.de
grs@claircom.com
tate_j@deboom.portal.com
bwalker@planetx.portal.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
James O'Dell jim@titan.fullerton.edu
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:01 CDT