Darren J Moffat wrote:
> Roland Mainz wrote:
> > IMO using projects(4), rctl etc. is an _overkill_. The idea is just to
> > lower the limit as "safeguard" without requiring "root" access (which
> > means projects(4) and SMF won't work... nor is it intended that the user
> > has to do some administrative stuff first).
>
> I was showing that the Solaris resource control framework can do so much
> more than a simple ulimit.
Ok... but we do not need the extended functionality.
> prctl doesn't require you have "root" privilege to set the basic limits
> (which is all you would be able to do via ulimit as an unprivileged user
> anyay). You don't have to use projects or SMF I was just pointing out
> how integrated this actually is with the rest of Solaris compared to a
> simple ulimit call.
Ok...
> > Simple example:
> > -- snip --
> > function mythr
> > {
> > sleep 100
> > }
> >
> > # main
> > builtin pthread_create
> >
> > intefer i
> > integer -a tid
> >
> > # set thread limit to 256
> > ulimit -T 256
>
> newtask
> prctl -n task.max-lwps -v 256 $$
The problem is that this is absolutely non-portable. Such scripts won't
be able to run outside Solaris unless you add something like...
-- snip --
if [[ "$(uname -s)" == "SunOS" ]] ; then
builtin -f solaris_rctl.so.1 newtask
builtin -f solaris_rctl.so.1 prctl
newtask
prctl -n task.max-lwps -v 256 $$
else
ulimit -T 256
fi
-- snip --
> > for (( i=0 ; i < (Inf/10000.) ; i++ )) ; do
> > pthread_create -L -f mythr -t tid[i] || break
> > done
> >
> > print -u2 "# waiting for children..."
> > wait -T "[EMAIL PROTECTED]"
> >
> > print -u2 "# done."
> > exit 0
> > -- snip --
>
> So replace that single ulimit call with a call to newtask (which can
> easily be written as a shell builtin if you desire) and set the
> task.max-lwps value using prctl. The prctl call can be done using the
> setrctl(2) syscall if you want to make that a shell built in as well.
Which operating systems support |setrctl()| ?
BTW: What happens if an adminstrator wants to set "task.max-lwps" from
outside the process ? AFAIK the hieracy is that "task." overrules
"process." ... however what happens if there is no "process." limit
which can be overriden ?
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) [EMAIL PROTECTED]
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 7950090
(;O/ \/ \O;)
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code