From 7e789df8dd9c7d86e9cc354521a37aa598aa5ec8 Mon Sep 17 00:00:00 2001
From: Rickard Green
Enable synchronous message passing to ports.
+As of OTP-R16 message passing to ports are truly asynchronously + implemented. Correctly written Erlang programs should be able + to handle this without any issues. Bugs in existing Erlang + programs that make false assumptions about message passing to + ports may, however, be tricky to find. This switch has been + introduced in order to at least make it easier to compare + behaviors during a transition period. Note that this flag is + deprecated as of its introduction, and is scheduled for removal + in OTP-R17.
+Sets the maximum number of concurrent processes for this
- system.
NOTE: It is possible to choose any value in the range - but powers of 2 perform best.
+Sets the maximum number of simultaneously existing processes for this
+ system. Valid range for
NOTE: The actual maximum chosen may be much larger than
+ the
The default value is
Sets the maximum number of simultaneously existing ports for this
+ system. Valid range for
NOTE: The actual maximum chosen may be much larger than
+ the actual
The default value used is normally
Previously the environment variable
For example, an R10 node is not automatically compatible
- with an R9 node, but R10 nodes started with the
Note: Make sure all nodes (Erlang-, C-, and Java nodes) of a distributed Erlang system is of the same Erlang/OTP release, or from two different Erlang/OTP releases X and Y, where all Y nodes have compatibility mode X.
-For example: A distributed Erlang system can consist of - R10 nodes, or of R9 nodes and R9-compatible R10 nodes, but - not of R9 nodes, R9-compatible R10 nodes and "regular" R10 - nodes, as R9 and "regular" R10 nodes are not compatible.
The content of this environment variable will be added to the
beginning of the command line for
The content of these environment variables will be added to the
end of the command line for
The maximum number of ports that can be open at the same
+ time can be configured by passing the
+
Returns a string containing the OTP release number.
Returns the number of ports currently existing at
+ the local node as an integer. The same value as
+
Returns the maximum number of simultaneously existing
+ ports at the local node as an integer. This limit
+ can be configured at startup by using the
+
Returns the number of processes currently existing at
the local node as an integer. The same value as
Returns the maximum number of concurrently existing +
Returns the maximum number of simultaneously existing
processes at the local node as an integer. This limit
- can be configured at startup by using the command line
- flag
Functions not explicitly documented as thread-safe are
- not thread-safe. Also note that some functions
+ Functions not explicitly documented as thread safe are
+ not thread safe. Also note that some functions
are only thread safe when used in a runtime
system with SMP support.
A function not explicitly documented as thread safe may at + some point in time have a thread safe implementation in the + runtime system. Such an implementation may however change to + a thread unsafe implementation at any time without + any notice at all. +
+Only use functions explicitly documented as thread safe + from arbitrary threads.
+This function returns the port owner process.
+Note that this function is not thread-safe, not + even when the emulator with SMP support is used.
Note that this function is not thread-safe, not + even when the emulator with SMP support is used.
This functions sends data in the special driver term - format. This is a fast way to deliver term data from a - driver. It also needs no binary conversion, so the port - owner process receives data as normal Erlang terms.
+ format to the port owner process. This is a fast way to + deliver term data from a driver. It also needs no binary + conversion, so the port owner process receives data as + normal Erlang terms. The +Note that the
The
Tuple and lists (with the exception of strings, see below), are built in reverse polish notation, so that to build a tuple, the elements are given first, and then the tuple @@ -1664,17 +1684,17 @@ ERL_DRV_EXT2TERM char *buf, ErlDrvUInt len ErlDrvPort port = ... ErlDrvTermData spec[] = { ERL_DRV_ATOM, driver_mk_atom("tcp"), - ERL_DRV_PORT, driver_mk_port(port), + ERL_DRV_PORT, driver_mk_port(drvport), ERL_DRV_INT, 100, ERL_DRV_BINARY, bin, 50, 0, ERL_DRV_LIST, 2, ERL_DRV_TUPLE, 3, }; - driver_output_term(port, spec, sizeof(spec) / sizeof(spec[0])); + erl_drv_output_term(driver_mk_port(drvport), spec, sizeof(spec) / sizeof(spec[0])); ]]>
Where
The term
The
If you want to pass a binary and don't already have the content
of the binary in an
This function is only thread-safe when the emulator with SMP + support is used.
+The parameters
Note that this function is not thread-safe, not even when the emulator with SMP support is used.
Note that this function is not thread-safe, not + even when the emulator with SMP support is used.
This function converts a port handle to the erlang term
- format, usable in the
Note that this function is not thread-safe, not + even when the emulator with SMP support is used.
This function is the only way for a driver to send data to
other processes than the port owner process. The
Note that the
The parameters
This function is only thread-safe when the emulator with SMP + support is used.
+Also note that parameters of
The parameters
This function is only thread-safe when the emulator with SMP support is used.
Enable synchronous message passing to ports.
-As of OTP-R16 message passing to ports are truly asynchronously - implemented. Correctly written Erlang programs should be able - to handle this without any issues. Bugs in existing Erlang - programs that make false assumptions about message passing to - ports may, however, be tricky to find. This switch has been - introduced in order to at least make it easier to compare - behaviors during a transition period. Note that this flag is - deprecated as of its introduction, and is scheduled for removal - in OTP-R17.
+Control behavior of signals to ports.
+As of OTP-R16 signals to ports are truly asynchronously
+ delivered. Note that signals always have been documented as
+ asynchronous. The underlying implementation has, however,
+ previously delivered these signals synchronously. Correctly
+ written Erlang programs should be able to handle this without
+ any issues. Bugs in existing Erlang programs that make false
+ assumptions about signals to ports may, however, be tricky to
+ find. This switch has been introduced in order to at least
+ make it easier to compare behaviors during a transition period.
+ Note that this flag is deprecated as of its
+ introduction, and is scheduled for removal in OTP-R17.
+
Set default scheduler hint for port parallelism. If set to
+
Suggested stack size, in kilowords, for scheduler threads.
diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml
index 2da456d49f..57346d3935 100644
--- a/erts/doc/src/erlang.xml
+++ b/erts/doc/src/erlang.xml
@@ -1000,14 +1000,14 @@ b
Sends an exit signal with exit reason
The following behavior apply if
If
Set scheduler hint for port parallelism. If set to
The default is
Closes an open port. Roughly the same as
For comparison:
Note that any process can close a port using
In short:
As of OTP-R16
Failure:
Sends data to a port. Same as
-
For comparison:
For comparison:
Note that any process can send to a port using
In short:
If the port is busy, the calling process will be suspended until the port is not busy anymore.
+As of OTP-R16
Failures:
Sets the port owner (the connected port) to
The port does not reply with
The new port owner gets linked to the port.
In short:
As of OTP-R16
Failure:
Currently the result will containt information about the
+ following
Failure:
Returns information about
Valid values of
Failure:
Returns information about
For valid values of
Failure:
Returns a string containing the OTP release number.
Returns the default port parallelism scheduling hint used.
+ For more information see the
+
Returns the number of ports currently existing at
--
cgit v1.2.3
From 9e4895da833b7777e69efc173f5dc777aaea3201 Mon Sep 17 00:00:00 2001
From: Rickard Green This field is used to pass driver capability information to the
- runtime system. If the This field is used to pass driver capability and other
+ information to the runtime system. If the
+
Sets and gets limits that will be used for controling the + busy state of the port message queue.
+The port message queue will be set into a busy
+ state when the amount of command data queued on the
+ message queue reaches the
Valid limits are values in the range
+
By passing a pointer to an integer variable containing
+ the value
The busy message queue feature can be disabled either
+ by setting the
Processes sending command data to the port will be suspended + if either the port is busy or if the port message queue is + busy. Suspended processes will be resumed when neither the + port is busy, nor the port message queue is busy.
+ +For information about busy port functionality
+ see the documentation of the
+
This function set and resets the busy status of the port. If
-
When the port is busy, sending to it with
This function set and unset the busy state of the port. If
+
Processes sending command data to the port will be suspended
+ if either the port is busy or if the port message queue
+ is busy. Suspended processes will be resumed when neither the
+ port is busy, nor the port message queue is busy. Command data
+ is in this context data passed to the port using either
+
If the
For information about busy port message queue functionality
+ see the documentation of the
+
Communication in Erlang is conceptually performed using + asynchronous signaling. All different executing entities + such as processes, and ports communicate via asynchronous + signals. The most commonly used signal is a message. Other + common signals are exit, link, unlink, monitor, demonitor + signals.
+The amount of time that passes between a signal being sent + and the arrival of the signal at the destination is unspecified + but positive. If the receiver has terminated, the signal will + not arrive, but it is possible that it triggers another signal. + For example, a link signal sent to a non-existing process will + trigger an exit signal which will be sent back to where the link + signal originated from. When communicating over the distribution, + signals may be lost if the distribution channel goes down.
+The only signal ordering guarantee given is the following. If
+ an entity sends multiple signals to the same destination entity,
+ the order will be preserved. That is, if
Some communication is synchronous. If broken down into pieces,
+ a synchronous communication operation, consists of two asynchronous
+ signals. One request signal and one reply signal. An example of
+ such a synchronous communication is a call to
The implementation of different asynchronous signals in the + VM may vary over time, but the behavior will always respect this + concept of asynchronous signals being passed between entities + as described above.
+By inspecting the implementation you might notice that some + specific signal actually gives a stricter guarantee than described + above. It is of vital importance that such knowledge about the + implementation is not used by Erlang code, since the + implementation might change at any time without prior notice.
+Some example of major implementation changes:
+The Erlang Runtime System Application ERTS.