From 91048957f0681dba853f5720d3618aa1c5d0255e Mon Sep 17 00:00:00 2001
From: Hans Bolinder
This document describes the changes made to the ERTS application.
+
+ Fixed
+ Own Id: OTP-13904 Aux Id: ERL-256
+
+
+ Own Id: OTP-13920 Aux Id: ERL-267
++ Fix a compilation error of erts in OpenBSD related to the + usage of the __errno variable.
++ Own Id: OTP-13927
++ Fixed so that when enabling tracing on a process that had + an invalid tracer associated with it, the new tracer + overwrites the old tracer. Before this fix, calling + erlang:trace/3 would behave as if the tracer was still + alive and not apply the new trace.
++ This fault was introduced in ERTS 8.0.
++ Own Id: OTP-13928
+
+ Fix parsing of
+ Own Id: OTP-13955 Aux Id: ERL-280
+
+ A slight improvement of
+ Own Id: OTP-13992
+Correct type declaration of match specification head. +
++ Own Id: OTP-13996
+
+ HiPE code loading failed for x86_64 if gcc was configured
+ with
+ Own Id: OTP-14031 Aux Id: ERL-294, PR-1239
+
+ Faulty arguments could be presented on exception from a
+ NIF that had rescheduled itself using
+
+ Own Id: OTP-14048
+
+ The runtime system could crash if a garbage collection on
+ a process was performed immediately after a NIF had been
+ rescheduled using
+ Own Id: OTP-14049
+
+ A reference to purged code could be left undetected by
+ the purge operation if a process just had rescheduled a
+ NIF call using
+ Own Id: OTP-14050
+Fixed a number of dirty scheduler related bugs:
+Process priority was not handled correct + when scheduling on a dirty scheduler.
The runtime system could crash when an exit + signal with a compound exit reason was sent to a process + executing on a dirty scheduler.
The + runtime system crashed when call tracing a process + executing on a dirty scheduler.
A + code purge operation could end up hanging forever when a + process executed on a dirty scheduler
+ Own Id: OTP-14051
++ Fixed a number of bugs that caused faulty stack-traces to + be created on exception when a process was traced.
++ Own Id: OTP-14055
++ Fix minor soft purge race bug that could incorrectly + trigger code_server to load new code for the module if + the soft purge failed and no current version of the + module existed.
++ Own Id: OTP-13925
+
+ To ease troubleshooting,
+ Own Id: OTP-13951
+
+ New environment variable
+ Own Id: OTP-14046
+Returns the current call stack back-trace (stacktrace)
of the process. The stack has the same format as returned by
Sets the maximum depth of call stack back-traces in the
- exit reason element of
Returns the old value of the flag.
On Unix systems, the Erlang runtime will interpret two types of signals.
+A
A
Introduced in ERTS 8.3 (Erlang/OTP 19.3)
+The signal
Own Id: OTP-14051
- Fixed a number of bugs that caused faulty stack-traces to - be created on exception when a process was traced.
-- Own Id: OTP-14055
-A better solution for a real module is to take advantage of the new
- directive
A loaded NIF library is tied to the Erlang module code version
- that loaded it. If the module is upgraded with a new version, the
- new Erlang code need to load its own NIF library (or maybe choose not
- to). The new code version can, however, choose to load the
- same NIF library as the old code if it wants to. Sharing the
- dynamic library means that static data defined by the library
- is shared as well. To avoid unintentionally shared static
- data, each Erlang module code can keep its own private data. This
- private data can be set when the NIF library is loaded and
- then retrieved by calling
A NIF library cannot be loaded explicitly. A library is - automatically unloaded when the module code that it belongs to is purged - by the code server.
+Once loaded, a NIF library is persistent. It will not be unloaded + until the module code version that it belongs to is purged.
All functions that a NIF library needs to do with Erlang are - performed through the NIF API functions. Functions exist +
All interaction between NIF code and the Erlang runtime system is + performed by calling NIF API functions. Functions exist for the following functionality:
A loaded NIF library is tied to the Erlang module instance
+ that loaded it. If the module is upgraded, the new module instance
+ needs to load its own NIF library (or maybe choose not to). The new
+ module instance can, however, choose to load the exact same NIF library
+ as the old code if it wants to. Sharing the dynamic library means that
+ static data defined by the library is shared as well. To avoid
+ unintentionally shared static data between module instances, each Erlang
+ module version can keep its own private data. This private data can be
+ set when the NIF library is loaded and later retrieved by calling
+
A NIF is thread-safe without any explicit synchronization as @@ -525,7 +525,7 @@ return term;
Returns various information about the current system
(emulator) as specified by
Returns the number of atoms currently existing at the + local node. The value is given as an integer.
+This document describes the changes made to the ERTS application.
++ Fix a quite rare bug causing VM crash during code loading + and the use of export funs (fun M:F/A) of not yet loaded + modules. Requires a very specfic timing of concurrent + scheduler threads. Has been seen on ARM but can probably + also occure on other architectures. Bug has existed since + OTP R16.
++ Own Id: OTP-14144 Aux Id: seq13242
+The definition of a busy scheduler is when it is not idle and is not scheduling (selecting) a process or port, that is:
@@ -6438,15 +6443,37 @@ lists:map(The list of scheduler information is unsorted and can appear in different order between calls.
+As of ERTS version 9.0, also dirty CPU schedulers will
+ be included in the result. That is, all scheduler threads
+ that are expected to handle CPU bound work. If you also
+ want information about dirty I/O schedulers, use
+
Normal schedulers will have scheduler identifiers in
+ the range
The different types of schedulers handle + specific types of jobs. Every job is assigned to a specific + scheduler type. Jobs can migrate between different schedulers + of the same type, but never between schedulers of different + types. This fact has to be taken under consideration when + evaluating the result returned.
Using
> erlang:system_flag(scheduler_wall_time, true). false > Ts0 = lists:sort(erlang:statistics(scheduler_wall_time)), ok. ok
Some time later the user takes another snapshot and calculates - scheduler-utilization per scheduler, for example:
+ scheduler utilization per scheduler, for example:> Ts1 = lists:sort(erlang:statistics(scheduler_wall_time)), ok. ok @@ -6461,11 +6488,32 @@ ok {7,0.973237033077876}, {8,0.9741297293248656}]
Using the same snapshots to calculate a total - scheduler-utilization:
+ scheduler utilization:> {A, T} = lists:foldl(fun({{_, A0, T0}, {_, A1, T1}}, {Ai,Ti}) -> - {Ai + (A1 - A0), Ti + (T1 - T0)} end, {0, 0}, lists:zip(Ts0,Ts1)), A/T. + {Ai + (A1 - A0), Ti + (T1 - T0)} end, {0, 0}, lists:zip(Ts0,Ts1)), + TotalSchedulerUtilization = A/T. +0.9769136803764825+
Total scheduler utilization will equal
Another (probably more) useful value is to calculate + total scheduler utilization weighted against maximum amount + of available CPU time:
++> WeightedSchedulerUtilization = (TotalSchedulerUtilization + * (erlang:system_info(schedulers) + + erlang:system_info(dirty_cpu_schedulers))) + / erlang:system_info(logical_processors_available). 0.9769136803764825+
This weighted scheduler utilization will reach
As of ERTS version 9.0, the Erlang runtime system + with SMP support will as default have more schedulers + than logical processors. This due to the dirty schedulers.
The same as
+ Dirty IO schedulers will have scheduler identifiers in
+ the range
+ Note that work executing on dirty I/O schedulers
+ are expected to mainly wait for I/O. That is, when you
+ get high scheduler utilization on dirty I/O schedulers,
+ CPU utilization is not expected to be high due to
+ this work. Returns the total amount of active processes and ports in
@@ -6495,7 +6568,7 @@ ok
Returns the total length of the run queues. That is, the number
@@ -6515,7 +6588,7 @@ ok
Returns information about wall clock. This option is ignored if the emulator does not have threading
- support enabled. This option is experimental and
- is supported only if the emulator was configured and built with
- support for dirty schedulers enabled (it is disabled by default).
This option is ignored if the emulator does not have threading - support enabled. This option is experimental and - is supported only if the emulator was configured and built with - support for dirty schedulers enabled (it is disabled by default).
+ support enabled.This option is ignored if the emulator does not have threading - support enabled. This option is experimental and - is supported only if the emulator was configured and built with - support for dirty schedulers enabled (it is disabled by default).
+ support enabled.The dirty NIF functionality described here
- is experimental. Dirty NIF support is available only when
- the emulator is configured with dirty schedulers enabled. This
- feature is disabled by default. The Erlang runtime
- without SMP support does not support dirty schedulers even when
- the dirty scheduler support is enabled. To check at runtime for
- the presence of dirty scheduler threads, code can use the
- Dirty NIF support is available only when the emulator is
+ configured with dirty scheduler support. As of ERTS version
+ 9.0, dirty scheduler support is enabled by default on the
+ runtime system with SMP support. The Erlang runtime without
+ SMP support does not support dirty schedulers even
+ when the dirty scheduler support is explicitly enabled. To
+ check at runtime for the presence of dirty scheduler threads,
+ code can use the
A NIF that cannot be split and cannot execute in a millisecond @@ -642,9 +642,6 @@ typedef struct {
The dirty NIF functionality described here is - experimental. You have to enable support for dirty - schedulers when building OTP to try out the functionality.
If the dirty NIF is expected to be CPU-bound, its
The dirty NIF functionality described here is - experimental. You have to enable support for dirty - schedulers when building OTP to try out the functionality.
Must be set to
The dirty schedulers functionality is experimental. - Enable support for dirty schedulers when building OTP to - try out the functionality.
-For more information, see
Notice that the dirty schedulers functionality is - experimental. Enable support for dirty schedulers when - building OTP to try out the functionality.
See also
Notice that the dirty schedulers functionality is - experimental. Enable support for dirty schedulers when - building OTP to try out the functionality.
For more information, see
This value can be set at startup by passing command-line
argument
Notice that the dirty schedulers functionality is - experimental. Enable support for dirty schedulers when - building OTP to try out the functionality.
For more information, see