aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_port.h
AgeCommit message (Collapse)Author
2019-01-28erts: Add magic port control numbersSverker Eriksson
to increase the probablity of a nice badarg from erlang:port_control.
2018-12-06erts: Move fds with active true behaviour to own pollsetLukas Larsson
At start of the VM a poll-set that the schedulers will check is created where fds that have triggered many (at the moment, many means 10) times without being deselected inbetween. In this scheduler specific poll-set fds do not use ONESHOT, which means that the number of syscalls goes down dramatically for such fds. This pollset is introduced in order to handle fds that are used by the erlang distribution and that never change their state from {active, true}. This pollset only handles ready_input events, ready_output is still handled by the poll threads. During overload, polling the scheduler poll-set is done on a 10ms timer.
2018-09-18erts: Refactor port dist_entry & conn_id into PRTSDSverker Eriksson
spelled out as "port specific data".
2018-09-18Consolidate distribution entry state transitionsSverker Eriksson
* Make connection_id part of the distribution handle as {ConnId, DistEntry} in order for BIFs to verify correct connection. * Make distribution handle opaque to net_kernel. * Remove some unsafe lockless reads of DistEntry.flags * Change state ERTS_DE_STATE_EXITING to be more of an internal state that prevents erts from enqueue, encode or schedule new data to be sent. Otherwise it should behave like ERTS_DE_STATE_CONNECTED.
2018-09-11erts: Fix bug in undocumented system_flag(scheduling_statistics)Sverker Eriksson
Uses port specific data out of bounds.
2018-04-26Remove error_logger process and add logger processSiri Hansen
2018-03-21Implementation of true asynchronous signaling between processesRickard Green
Communication between Erlang processes has conceptually always been performed through asynchronous signaling. The runtime system implementation has however previously preformed most operation synchronously. In a system with only one true thread of execution, this is not problematic (often the opposite). In a system with multiple threads of execution (as current runtime system implementation with SMP support) it becomes problematic. This since it often involves locking of structures when updating them which in turn cause resource contention. Utilizing true asynchronous communication often avoids these resource contention issues. The case that triggered this change was contention on the link lock due to frequent updates of the monitor trees during communication with a frequently used server. The signal order delivery guarantees of the language makes it hard to change the implementation of only some signals to use true asynchronous signaling. Therefore the implementations of (almost) all signals have been changed. Currently the following signals have been implemented as true asynchronous signals: - Message signals - Exit signals - Monitor signals - Demonitor signals - Monitor triggered signals (DOWN, CHANGE, etc) - Link signals - Unlink signals - Group leader signals All of the above already defined as asynchronous signals in the language. The implementation of messages signals was quite asynchronous to begin with, but had quite strict delivery constraints due to the ordering guarantees of signals between a pair of processes. The previously used message queue partitioned into two halves has been replaced by a more general signal queue partitioned into three parts that service all kinds of signals. More details regarding the signal queue can be found in comments in the erl_proc_sig_queue.h file. The monitor and link implementations have also been completely replaced in order to fit the new asynchronous signaling implementation as good as possible. More details regarding the new monitor and link implementations can be found in the erl_monitor_link.h file.
2018-03-05Replace usage of ERTS_PSFLG_BOUNDRickard Green
2018-02-22Merge 'sverker/erts/more-crash-dump-info/OTP-14820'Sverker Eriksson
2018-02-20erts,observer: Add more port info to crash dumpSverker Eriksson
2017-09-06Merge branch 'maint' into john/erts/merge-zlib-and-vector-qJohn Högberg
2017-09-05erts: Add nif ioqLukas Larsson
2017-07-17erts: Replace usage of all erts_smp prefixes to just ertsLukas Larsson
2017-07-17erts: Cleanup removal of non-smp emulatorsLukas Larsson
2017-07-17erts: Remove ERTS_SMP and USE_THREAD definesLukas Larsson
This refactor was done using the unifdef tool like this: for file in $(find erts/ -name *.[ch]); do unifdef -t -f defile -o $file $file; done where defile contained: #define ERTS_SMP 1 #define USE_THREADS 1 #define DDLL_SMP 1 #define ERTS_HAVE_SMP_EMU 1 #define SMP 1 #define ERL_BITS_REENTRANT 1 #define ERTS_USE_ASYNC_READY_Q 1 #define FDBLOCK 1 #undef ERTS_POLL_NEED_ASYNC_INTERRUPT_SUPPORT #define ERTS_POLL_ASYNC_INTERRUPT_SUPPORT 0 #define ERTS_POLL_USE_WAKEUP_PIPE 1 #define ERTS_POLL_USE_UPDATE_REQUESTS_QUEUE 1 #undef ERTS_HAVE_PLAIN_EMU #undef ERTS_SIGNAL_STATE
2017-06-14Update copyright yearHans Nilsson
2017-05-16Merge pull request #1435 from SalikhovDinislam/static_funcLukas Larsson
erts: Make erts_schedule_proc2port_signal static
2017-04-30Make a function staticSalikhov Dinislam
2016-11-22Merge branch 'maint'Sverker Eriksson
2016-11-17erts: Fix all -Wundef errorsSverker Eriksson
2016-11-17erts: Refactor crash dumping with cbprintfSverker Eriksson
Instead of passing around a file descriptor use a function pointer to facilitate more advanced backend write logic such as size limitation or compression.
2016-06-10erts: Add port monitorsDmytro Lytovchenko
* erlang:monitor/2 with port argument is added, erlang:demonitor, using port task API and avoiding locking; * port_info and process_info support for monitored ports (with named port monitors support); * Exit signals contain type 'process' or 'port'; * Propagation of port exit signals; * Self-cleaning when origin process dies with monitor on; * 8 test cases + testcase for port driver crashing; * Documentation for all of the above (monitor, demonitor, port_info and process_info) updated
2016-05-11Add better support for communication with a process executing dirty NIFRickard Green
- Termination of a process... - Modify trace flags of process... - Process info on process... - Register/unregister of name on process... - Set group leader on process... ... while it is executing a dirty NIF.
2016-04-15erts: Extend process and port tracingLukas Larsson
This commit completes the tracing for processes so that all messages sent by a process (via nifs or otherwise) will be traced. The commit also adds tracing of all types of events from ports. When enabling tracing using erlang:trace, the 'all' flag now also enables tracing on all ports. OTP-13496
2016-04-13Merge branch 'henrik/update-copyrightyear'Henrik Nord
* henrik/update-copyrightyear: update copyright-year
2016-03-29Merge branch 'lukas/erts/enif_trace_functions/OTP-13442'Lukas Larsson
* lukas/erts/enif_trace_functions/OTP-13442: erts: Fix bug in enif_send erts: Fix windows nif port tests erts: Fix bug in enif_term_to_binary erts: Remove printout when dec_term fails in DEBUG erts: Polish erl_nif docs erts: Improve enif_binary_to_term erts: Add enif_port_command erts: Add enif_term_to_binary and enif_binary_to_term erts: Add enif_is_process/port_alive erts: Add enif_cpu/now_time and enif_make_unique_integer
2016-03-29erts: Add enif_port_commandLukas Larsson
2016-03-24Improve process/port specific data managementRickard Green
2016-03-15update copyright-yearHenrik Nord
2015-12-15erts: Create forker process for spawn driverLukas Larsson
Instead of forking from the beam process, we create a separate process in which all forks are done. This has several advantages: 1) performance: * don't have to close all fd's in the world * fork only has to copy stuff from a small process * work is done in a completely seperate process * a 3x performance increase has been measured, can be made even greater (10x) if we cache the environment in child setup 2) stability * the exec is done in another process than beam, which means that if the file that we exec to is on an nfs that is not available right now we will not block a scheduler until the nfs returns. 3) simplicity * don't have to deal with SIGCHLD in the erts Unfortunately, this solution also implies some badness. 1) There will always be a seperate process running together with beam on unix. This could be confusing and undesirable. 2) We have to transfer the entire environment to child_setup for each command. OTP-13088
2015-12-15erts: Add support for asynchronous open_portLukas Larsson
OTP-13086
2015-06-18Change license text to APLv2Bruce Yinhe
2015-06-17Save IO bytes in scheduler specific dataRickard Green
2015-05-08Optimized timer implementationRickard Green
2013-05-06Only verify not busy for erlang:send(Port, Msg, [nosuspend]) until scheduledRickard Green
2013-04-29Do not treat port_set_data/port_get_data as signalsRickard Green
2013-02-25Set default max ports on win32 to 8192Lukas Larsson
2013-02-22Update copyright yearsBjörn-Egil Dahlberg
2013-02-13Implement erl_drv_consume_timeslice()Rickard Green
2013-02-13Fix driver port accessesRickard Green
2013-01-23Bump reductions also for immediate driver callsRickard Green
2012-12-17Fix driver_monitor_process() ASSERTRickard Green
2012-12-07Merge branch 'rickard/port-optimizations/OTP-10336' into ↵Rickard Green
rickard/r16/port-optimizations/OTP-10336 * rickard/port-optimizations/OTP-10336: Change annotate level for emacs-22 in cerl Update etp-commands Add documentation on communication in Erlang Add support for busy port message queue Add driver callback epilogue Implement true asynchronous signaling between processes and ports Add erl_drv_[send|output]_term Move busy port flag Use rwlock for driver list Optimize management of port tasks Improve configuration of process and port tables Remove R9 compatibility features Use ptab functionality also for ports Prepare for use of ptab functionality also for ports Atomic port state Generalize process table implementation Implement functionality for delaying thread progress from unmanaged threads Conflicts: erts/doc/src/erl_driver.xml erts/doc/src/erlang.xml erts/emulator/beam/beam_bif_load.c erts/emulator/beam/beam_bp.c erts/emulator/beam/beam_emu.c erts/emulator/beam/bif.c erts/emulator/beam/copy.c erts/emulator/beam/erl_alloc.c erts/emulator/beam/erl_alloc.types erts/emulator/beam/erl_bif_info.c erts/emulator/beam/erl_bif_port.c erts/emulator/beam/erl_bif_trace.c erts/emulator/beam/erl_init.c erts/emulator/beam/erl_message.c erts/emulator/beam/erl_port_task.c erts/emulator/beam/erl_process.c erts/emulator/beam/erl_process.h erts/emulator/beam/erl_process_lock.c erts/emulator/beam/erl_trace.c erts/emulator/beam/export.h erts/emulator/beam/global.h erts/emulator/beam/io.c erts/emulator/sys/unix/sys.c erts/emulator/sys/vxworks/sys.c erts/emulator/test/port_SUITE.erl erts/etc/unix/cerl.src erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/prim_inet.beam erts/preloaded/src/prim_inet.erl lib/hipe/cerl/erl_bif_types.erl lib/kernel/doc/src/inet.xml lib/kernel/src/inet.erl
2012-12-07Add support for busy port message queueRickard Green
2012-12-07Add driver callback epilogueRickard Green
2012-12-07Implement true asynchronous signaling between processes and portsRickard Green
2012-12-03Add erl_drv_[send|output]_termRickard Green
2012-12-03Move busy port flagRickard Green
2012-12-03Optimize management of port tasksRickard Green
2012-12-03Improve configuration of process and port tablesRickard Green