summaryrefslogtreecommitdiff
path: root/lib/stdlib/test/shell_docs_SUITE_data/unknown_erlang_spawn_opt_4_func.txt
blob: 22956f6ce93614a79f3a30acb81cced957524ff0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133

  -spec spawn_opt(Module, Function, Args, Options) ->
                     Pid | {Pid, MonitorRef}
                     when
                         Module :: module(),
                         Function :: atom(),
                         Args :: [term()],
                         Options :: [spawn_opt_option()],
                         Pid :: pid(),
                         MonitorRef :: reference().

  Types:
    -type max_heap_size() ::
          Size ::
              non_neg_integer() |
              #{size => non_neg_integer(),
                kill => boolean(),
                error_logger => boolean()}.
    -type message_queue_data() :: off_heap | on_heap.
    -type priority_level() :: low | normal | high | max.
    -type spawn_opt_option() ::
          link | monitor |
          {monitor, MonitorOpts :: [monitor_option()]} |
          {priority, Level :: priority_level()} |
          {fullsweep_after, Number :: non_neg_integer()} |
          {min_heap_size, Size :: non_neg_integer()} |
          {min_bin_vheap_size, VSize :: non_neg_integer()} |
          {max_heap_size, Size :: max_heap_size()} |
          {message_queue_data, MQD :: message_queue_data()}.

  Works as spawn/3, except that an extra option list is specified
  when creating the process.

  If option monitor is specified, the newly created process is
  monitored, and both the pid and reference for the monitor are
  returned.

  Options:

  link:
    Sets a link to the parent process (like spawn_link/3 does).

  monitor:
    Monitors the new process (like monitor(process, Pid) does).
    A {Pid, MonitorRef} tuple will be returned instead of just a 
    Pid.

  {monitor, MonitorOpts}:
    Monitors the new process with options (like monitor(process,
    Pid, MonitorOpts) does). A {Pid, MonitorRef} tuple will be
    returned instead of just a Pid.

  {priority, Level}:
    Sets the priority of the new process. Equivalent to executing 
    process_flag(priority, Level) in the start function of the
    new process, except that the priority is set before the
    process is selected for execution for the first time. For more
    information on priorities, see process_flag(priority, Level).

  {fullsweep_after, Number}:
    Useful only for performance tuning. Do not use this option
    unless you know that there is problem with execution times or
    memory consumption, and ensure that the option improves
    matters.

    The Erlang runtime system uses a generational garbage
    collection scheme, using an "old heap" for data that has
    survived at least one garbage collection. When there is no
    more room on the old heap, a fullsweep garbage collection is
    done.

    Option fullsweep_after makes it possible to specify the
    maximum number of generational collections before forcing a
    fullsweep, even if there is room on the old heap. Setting the
    number to zero disables the general collection algorithm, that
    is, all live data is copied at every garbage collection.

    A few cases when it can be useful to change fullsweep_after:

     • If binaries that are no longer used are to be thrown
       away as soon as possible. (Set Number to zero.)

     • A process that mostly have short-lived data is
       fullsweeped seldom or never, that is, the old heap
       contains mostly garbage. To ensure a fullsweep
       occasionally, set Number to a suitable value, such as
       10 or 20.

     • In embedded systems with a limited amount of RAM and no
       virtual memory, you might want to preserve memory by
       setting Number to zero. (The value can be set
       globally, see erlang:system_flag/2.)

  {min_heap_size, Size}:
    Useful only for performance tuning. Do not use this option
    unless you know that there is problem with execution times or
    memory consumption, and ensure that the option improves
    matters.

    Gives a minimum heap size, in words. Setting this value higher
    than the system default can speed up some processes because
    less garbage collection is done. However, setting a too high
    value can waste memory and slow down the system because of
    worse data locality. Therefore, use this option only for
    fine-tuning an application and to measure the execution time
    with various Size values.

  {min_bin_vheap_size, VSize}:
    Useful only for performance tuning. Do not use this option
    unless you know that there is problem with execution times or
    memory consumption, and ensure that the option improves
    matters.

    Gives a minimum binary virtual heap size, in words. Setting
    this value higher than the system default can speed up some
    processes because less garbage collection is done. However,
    setting a too high value can waste memory. Therefore, use this
    option only for fine-tuning an application and to measure the
    execution time with various VSize values.

  {max_heap_size, Size}:
    Sets the max_heap_size process flag. The default 
    max_heap_size is determined by command-line argument +hmax
    in erl(1). For more information, see the documentation of 
    process_flag(max_heap_size, Size).

  {message_queue_data, MQD}:
    Sets the value of the message_queue_data process flag. MQD
    can be either off_heap or on_heap. The default value of
    the message_queue_data process flag is determined by the
    command-line argument +hmqd in erl(1). For more
    information, see the documentation of 
    process_flag(message_queue_data, MQD).