“OTP 源码编译”的版本间的差异

来自Dennis的知识库
跳转到: 导航搜索
(以“<pre> git clone https://github.com/erlang/otp.git cd otp export ERL_TOP=`pwd` ./otp_build setup brew install fop openssl ./configure --help #查看编译选项 ./co...”为内容创建页面)
 
第1行: 第1行:
 +
== OTP 源码阅读杂记 ==
 +
 +
=== 编译 ===
 
<pre>
 
<pre>
 
git clone https://github.com/erlang/otp.git
 
git clone https://github.com/erlang/otp.git
第8行: 第11行:
 
./configure --with-ssl=/usr/local/opt/openssl
 
./configure --with-ssl=/usr/local/opt/openssl
 
make
 
make
 +
</pre>
 +
 +
=== erl_process.c ===
 +
 +
* 优先运行 port 直到完成。
 +
<pre>
 +
/*
 +
* Find a new port to run.
 +
*/
 +
 +
if (RUNQ_READ_LEN(&rq->ports.info.len)) {
 +
    int have_outstanding_io;
 +
    have_outstanding_io = erts_port_task_execute(rq, &esdp->current_port);
 +
    if ((!erts_eager_check_io
 +
&& have_outstanding_io
 +
&& fcalls > 2*input_reductions)
 +
|| rq->halt_in_progress) {
 +
/*
 +
* If we have performed more than 2*INPUT_REDUCTIONS since
 +
* last call to erl_sys_schedule() and we still haven't
 +
* handled all I/O tasks we stop running processes and
 +
* focus completely on ports.
 +
*
 +
* One could argue that this is a strange behavior. The
 +
* reason for doing it this way is that it is similar
 +
* to the behavior before port tasks were introduced.
 +
* We don't want to change the behavior too much, at
 +
* least not at the time of writing. This behavior
 +
* might change in the future.
 +
*
 +
* /rickard
 +
*/
 +
goto check_activities_to_run;
 +
    }
 +
}
 +
</pre>
 +
 +
* erl_lock_check.c  确保 BEAM 的加锁顺序是一致的,防止死锁。
 +
<pre>
 +
* Description: A lock checker that checks that each thread acquires
 +
*              locks according to a predefined global lock order. The
 +
*              global lock order is used to prevent deadlocks. If the
 +
*              lock order is violated, an error message is printed
 +
*              and the emulator aborts. The lock checker is only
 +
*              intended to be enabled when debugging.
 
</pre>
 
</pre>

2017年1月7日 (六) 11:21的版本

OTP 源码阅读杂记

编译

git clone https://github.com/erlang/otp.git
cd otp
export ERL_TOP=`pwd`
./otp_build  setup
brew install fop openssl
./configure --help #查看编译选项
./configure --with-ssl=/usr/local/opt/openssl
make

erl_process.c

  • 优先运行 port 直到完成。
	/*
	 * Find a new port to run.
	 */

	if (RUNQ_READ_LEN(&rq->ports.info.len)) {
	    int have_outstanding_io;
	    have_outstanding_io = erts_port_task_execute(rq, &esdp->current_port);
	    if ((!erts_eager_check_io
		 && have_outstanding_io
		 && fcalls > 2*input_reductions)
		|| rq->halt_in_progress) {
		/*
		 * If we have performed more than 2*INPUT_REDUCTIONS since
		 * last call to erl_sys_schedule() and we still haven't
		 * handled all I/O tasks we stop running processes and
		 * focus completely on ports.
		 *
		 * One could argue that this is a strange behavior. The
		 * reason for doing it this way is that it is similar
		 * to the behavior before port tasks were introduced.
		 * We don't want to change the behavior too much, at
		 * least not at the time of writing. This behavior
		 * might change in the future.
		 *
		 * /rickard
		 */
		goto check_activities_to_run;
	    }
	}
  • erl_lock_check.c 确保 BEAM 的加锁顺序是一致的,防止死锁。
 * Description: A lock checker that checks that each thread acquires
 *              locks according to a predefined global lock order. The
 *              global lock order is used to prevent deadlocks. If the
 *              lock order is violated, an error message is printed
 *              and the emulator aborts. The lock checker is only
 *              intended to be enabled when debugging.
个人工具
名字空间

变换
操作
导航
工具箱