From: Charles Oliver Nutter Date: 2011-10-31T07:31:07+09:00 Subject: [ruby-core:40540] Re: [Ruby 1.9 - Feature #3187] Allow dynamic Fiber stack size --20cf301d424c8016b804b08baddc Content-Type: text/plain; charset=UTF-8 Quick comments. * JVM can specify per-thread stack size but always in bytes. Any API that exposes stack size should be abstract rather than require a knowledge of stack frame sizes from impl to impl. The "stack size factor" version is pretty good. * I agree it would be nice to specify per-thread stack sizes too. We must do this for JRuby on Android, and have to use JRuby- specific mechanisms for it. - Charlie (mobile) On Oct 30, 2011 11:21 AM, "SASADA Koichi" wrote: > > Hi, > > I agree with this proposal. Also add same parameter setting feature for > Thread. > > However, I can't make good API to specify stack (VM and machine) size > (and other parameters if there are). > > There are several proposals. > > Type 1: Thread creating argument (ex: Thread.new(stack_size: 1024)) > Type 2: Thread global parameter (ex: Thread.stack_size = 1024) > > I think Type 2 is not good (to set default value is okay. However it > conflicts other usage. Typically thread-unsafe). > > I also think Type 1 has also problem. If you want to pass keyword > argument "stack_size" to fiber or thread, it should be conflict. > > My idea is creating new Thread (Fiber) class with new parameter: > > MyThread = Thread.new_template(stack_size: 1024) > MyThread.new{ > ... > } > > # Of course "new_template" is bad name. > > Any ideas? > > > (2011/10/12 21:42), Robert Pankowecki wrote: > > > > Issue #3187 has been updated by Robert Pankowecki. > > > > > > I would also welcome such improvement. > > ---------------------------------------- > > Feature #3187: Allow dynamic Fiber stack size > > http://redmine.ruby-lang.org/issues/3187 > > > > Author: Mike Perham > > Status: Open > > Priority: Normal > > Assignee: > > Category: > > Target version: 1.9.x > > > > > > =begin > > I'd like a way to increase the size of the Fiber stack dynamically so when my program starts, I can set it to whatever value I need for the code I'm running. 4KB is too easy to run into problems when running recursive code but settling on any arbitrary static value seems pointless to me. > > =end > > > > > > > > > -- > // SASADA Koichi at atdot dot net > --20cf301d424c8016b804b08baddc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Quick comments.

* JVM can specify per-thread stack size but always in bytes. Any API tha= t exposes stack size should be abstract rather than require a knowledge of = stack frame sizes from impl to impl. The "stack size factor" vers= ion is pretty good.

* I agree it would be nice to specify per-thread stack sizes too. We mus= t do this for JRuby on Android, and have to use JRuby- specific mechanisms = for it.

-=C2=A0 Charlie (mobile)

On Oct 30, 2011 11:21 AM, "SASADA Koichi" <ko1@atdot.net> wrote:
>
> Hi,
>
> I agree with this proposal. =C2=A0Also add same parameter setting feat= ure for
> Thread.
>
> However, I can't make good API to specify stack (VM and machine) s= ize
> (and other parameters if there are).
>
> There are several proposals.
>
> Type 1: Thread creating argument (ex: Thread.new(stack_size: 1024)) > Type 2: Thread global parameter (ex: Thread.stack_size =3D 1024)
>
> I think Type 2 is not good (to set default value is okay. =C2=A0Howeve= r it
> conflicts other usage. =C2=A0Typically thread-unsafe).
>
> I also think Type 1 has also problem. =C2=A0If you want to pass keywor= d
> argument "stack_size" to fiber or thread, it should be confl= ict.
>
> My idea is creating new Thread (Fiber) class with new parameter:
>
> =C2=A0MyThread =3D Thread.new_template(stack_size: 1024)
> =C2=A0MyThread.new{
> =C2=A0 =C2=A0...
> =C2=A0}
>
> # Of course "new_template" is bad name.
>
> Any ideas?
>
>
> (2011/10/12 21:42), Robert Pankowecki wrote:
> >
> > Issue #3187 has been updated by Robert Pankowecki.
> >
> >
> > I would also welcome such improvement.
> > ----------------------------------------
> > Feature #3187: Allow dynamic Fiber stack size
> > http://redmi= ne.ruby-lang.org/issues/3187
> >
> > Author: Mike Perham
> > Status: Open
> > Priority: Normal
> > Assignee:
> > Category:
> > Target version: 1.9.x
> >
> >
> > =3Dbegin
> > =C2=A0I'd like a way to increase the size of the Fiber stack = dynamically so when my program starts, I can set it to whatever value I nee= d for the code I'm running. =C2=A04KB is too easy to run into problems = when running recursive code but settling on any arbitrary static value seem= s pointless to me.
> > =3Dend
> >
> >
> >
>
>
> --
> // SASADA Koichi at atdot dot net
>

--20cf301d424c8016b804b08baddc--