Issue #6695 has been updated by headius (Charles Nutter).


Stack size:

I will agree in part with Brian's statement about stack size being too implementation-dependent. It's also 32/64-bit dependent. On the JVM, it's also platform-dependent (Windows will have different stack layout than Linux). In addition, the size of frames on the stack can vary even within the same runtime as code gets JIT compiled and condenses multiple calls' frames into one.

So I don't have a strong objection to being able to specify stack size (java.lang.Thread allows this) but it won't be possible to select a single size that works for all implementations (unless it's large enough no implementation would hit it). This also applies to "small", "medium", "large" and ratios...the JVM itself chooses stack size per-platform, so the actual stack sizes will vary and stack size ratios/tiers still won't produce consistent results across platforms or impls.

For a specific runtime on a specific platform, specifying stack size may be useful (e.g. Ruboto (JRuby on Android) does it for threads on Dalvik, where stack depth is often too small for our interpreter).

Name:

I don't see a reason *not* to support :name in config, if pre-run config is added. #name and #name= probably could come along...JVM threads support setting name, and I've always thought of this as a gap in Thread's API.
----------------------------------------
Feature #6695: Configuration for Thread/Fiber creation
https://bugs.ruby-lang.org/issues/6695#change-28239

Author: ko1 (Koichi Sasada)
Status: Assigned
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: core
Target version: 2.0.0


=begin
= Abstract

With Feature #6694, the following configuration parameters should be allowed for Thread/Fiber creation.

Group1 (new parameters):
* name: Thread/Fiber name
* vm_stack_size: VM's stack size
* machine_stack_size: Machine stack size

Group2 (existing parameters):
* local_storage: Initial Thread/Fiber local parameters
* thread_group: Thread group (Thread only)
* priority: Initial priority Thread#priority= (Thread only)
* abort_on_exception: abort on exception (Thread only)

= Background

With Feature #6694, we have a way to specify configurations for Thread creation.  Fiber.new() don't receive any parameters now.

= Proposal

This is a initial proposal of configuration for Thread/Fiber creation.

Group1 (new parameters):
* name: Thread/Fiber name
* vm_stack_size: VM's stack size
* machine_stack_size: Machine stack size

vm_stack_size and machine_stack_size are OS dependent (This means that it will be *hint* parameter).

Thread#inspect should use `name' parameter.

I also propose a new method Thread#name to get the thread name specified by this parameter.

Group2 (existing parameters):
* local_storage: Initial Thread/Fiber local parameters
* thread_group: Thread group (Thread only)
* priority: Initial priority Thread#priority= (Thread only)
* abort_on_exception: abort on exception (Thread only)

Now, we can specify Group2 parameters only *after* thread creation.  With this parameter, we can specify parameters before thread creation.

=end



-- 
http://bugs.ruby-lang.org/