[Erlang 0119] Erlang OTP 源码阅读指引
A.惟有真理必胜 B.惟有谎言必胜 C.惟有时尚必胜 D.惟有金钱必胜
[观众哈哈大笑.一滴汗珠从贾马尔的额头流下来.普瑞姆喜欢贾马尔的不安.]
贾马尔:是的.
普瑞姆(吃惊):什么是的?
贾马尔:求助观众.
[普瑞姆吹口哨.举目望向观众席.]
普瑞姆:那么女士们、先生们,请帮他解难吧.现在请按下你们的选择键.
[灯光转暗.让人紧张的音乐声响起.]
[督察按暂停键.叹了口气.]
督察:贾马尔,我五岁大的女儿都知道答案,你却不知道.这对一个天才百万富翁来说,不是很奇怪吗?怎么回事?你的作弊同伙跑出去撒尿了是吗?又或者是他咳得不够大声?
[沉默.斯里尼瓦斯警员朝贾马尔的椅子踢了一脚.]
斯里尼瓦斯警员:督察问你话呢.
贾马尔:在乔帕蒂海滩吉万的小吃摊上,炸脆饼多少钱?
督察:什么?
贾马尔:一份炸脆饼,多少钱?
斯里尼瓦斯警员(忍不住说):十卢比.
贾马尔:错.排灯节过后就是十五卢比了.上个星期四,是谁在达达尔车站外面偷了瓦尔马警员的自行车?
督察(被逗乐了):你知道是谁偷的?
贾马尔:朱胡区的每个人都知道.连五岁的小孩儿都知道.
源码下载
源码阅读工具
Overview
Kernel Kernel APP
kernel.erl
kernel_config.erl
kernel.appup.src
kernel.app.src application管理
application_controller.erl
application_starter.erl
application_master.hrl
application_master.erl
application.erl
heart.erl HIPE
hipe_ext_format.hrl
hipe_unified_loader.erl 调试& 日志
日志
disk_log.erl
disk_log_sup.erl
disk_log_server.erl
disk_log_1.erl
disk_log.hrl
error_logger.erl
wrap_log_reader.erl
调试
error_handler.erl
erts_debug.erl
standard_error.erl
seq_trace.erl
IO
文件IO
file.erl
file_server.erl
file_io_server.erl
ram_file.erl
网络IO
gen_sctp.erl
gen_udp.erl
gen_tcp.erl
inet.erl
inet_config.hrl
inet_config.erl
inet_boot.hrl
inet6_udp.erl
inet6_tcp_dist.erl
inet6_tcp.erl
inet6_sctp.erl
inet_db.erl
inet_dns.hrl
inet_dns.erl
inet_gethost_native.erl
inet_udp.erl
inet_tcp_dist.erl
inet_tcp.erl
inet_sctp.erl
inet_res.hrl
inet_res.erl
inet_parse.erl
inet_int.hrl
inet_hosts.erl
inet_dns_record_adts.pl
erl_reply.erl
net_kernel.erl
net_adm.erl
net.erl
IO Request
user_drv.erl
user.erl
user_sup.erl
group.erl Code生命周期管理
code.erl
code_server.erl
erl_boot_server.erl
erl_ddll.erl distribute管理
dist_util.erl
dist_ac.erl
Distributed Applications Controller
erl_distribution.erl
erl_epmd.erl
rpc.erl
pg2.erl
global_search.erl
global_group.erl
global.erl
auth.erl
OS
os.erl
Dive into ERTS
/*
** Data types:
**
** Eterm: A tagged erlang term (possibly 64 bits)
** BeamInstr: A beam code instruction unit, possibly larger than Eterm, not smaller.
** UInt: An unsigned integer exactly as large as an Eterm.
** SInt: A signed integer exactly as large as an eterm and therefor large
** enough to hold the return value of the signed_val() macro.
** UWord: An unsigned integer at least as large as a void * and also as large
** or larger than an Eterm
** SWord: A signed integer at least as large as a void * and also as large
** or larger than an Eterm
** Uint32: An unsigned integer of 32 bits exactly
** Sint32: A signed integer of 32 bits exactly
** Uint16: An unsigned integer of 16 bits exactly
** Sint16: A signed integer of 16 bits exactly.
*/
copy = last = CONS(hp, CAR(list_val(list)), make_list(hp + 2));
list = CDR(list_val(list));
#define CONS(hp, car, cdr) \
(CAR(hp)=(car), CDR(hp)=(cdr), make_list(hp)) #define CAR(x) ((x)[0])
#define CDR(x) ((x)[1])
struct process {
ErtsPTabElementCommon common; /* *Need* to be first in struct */ /* All fields in the PCB that differs between different heap
* architectures, have been moved to the end of this struct to
* make sure that as few offsets as possible differ. Different
* offsets between memory architectures in this struct, means that
* native code have to use functions instead of constants.
*/ Eterm* htop; /* Heap top */
Eterm* stop; /* Stack top */
Eterm* heap; /* Heap start */
Eterm* hend; /* Heap end */
Uint heap_sz; /* Size of heap in words */
Uint min_heap_size; /* Minimum size of heap (in words). */
Uint min_vheap_size; /* Minimum size of virtual heap (in words). */ #if !defined(NO_FPE_SIGNALS) || defined(HIPE)
volatile unsigned long fp_exception;
#endif #ifdef HIPE
/* HiPE-specific process fields. Put it early in struct process,
to enable smaller & faster addressing modes on the x86. */
struct hipe_process_state hipe;
#endif /*
* Saved x registers.
*/
Uint arity; /* Number of live argument registers (only valid
* when process is *not* running).
*/
Eterm* arg_reg; /* Pointer to argument registers. */
unsigned max_arg_reg; /* Maximum number of argument registers available. */
Eterm def_arg_reg[6]; /* Default array for argument registers. */ BeamInstr* cp; /* (untagged) Continuation pointer (for threaded code). */
BeamInstr* i; /* Program counter for threaded code. */
Sint catches; /* Number of catches on stack */
Sint fcalls; /*
* Number of reductions left to execute.
* Only valid for the current process.
*/
Uint32 rcount; /* suspend count */
int schedule_count; /* Times left to reschedule a low prio process */
Uint reds; /* No of reductions for this process */
Eterm group_leader; /* Pid in charge
(can be boxed) */
Uint flags; /* Trap exit, etc (no trace flags anymore) */
Eterm fvalue; /* Exit & Throw value (failure reason) */
Uint freason; /* Reason for detected failure */
Eterm ftrace; /* Latest exception stack trace dump */ Process *next; /* Pointer to next process in run queue */ struct ErtsNodesMonitor_ *nodes_monitors; ErtsSuspendMonitor *suspend_monitors; /* Processes suspended by
this process via
erlang:suspend_process/1 */ ErlMessageQueue msg; /* Message queue */ union {
ErtsBifTimer *bif_timers; /* Bif timers aiming at this process */
void *terminate;
} u; ProcDict *dictionary; /* Process dictionary, may be NULL */ Uint seq_trace_clock;
Uint seq_trace_lastcnt;
Eterm seq_trace_token; /* Sequential trace token (tuple size 5 see below) */ #ifdef USE_VM_PROBES
Eterm dt_utag; /* Place to store the dynamc trace user tag */
Uint dt_utag_flags; /* flag field for the dt_utag */
#endif
BeamInstr initial[3]; /* Initial module(0), function(1), arity(2), often used instead
of pointer to funcinfo instruction, hence the BeamInstr datatype */
BeamInstr* current; /* Current Erlang function, part of the funcinfo:
* module(0), function(1), arity(2)
* (module and functions are tagged atoms;
* arity an untagged integer). BeamInstr * because it references code
*/ /*
* Information mainly for post-mortem use (erl crash dump).
*/
Eterm parent; /* Pid of process that created this process. */
erts_approx_time_t approx_started; /* Time when started. */ /* This is the place, where all fields that differs between memory
* architectures, have gone to.
*/ Eterm *high_water;
Eterm *old_hend; /* Heap pointers for generational GC. */
Eterm *old_htop;
Eterm *old_heap;
Uint16 gen_gcs; /* Number of (minor) generational GCs. */
Uint16 max_gen_gcs; /* Max minor gen GCs before fullsweep. */
ErlOffHeap off_heap; /* Off-heap data updated by copy_struct(). */
ErlHeapFragment* mbuf; /* Pointer to message buffer list */
Uint mbuf_sz; /* Size of all message buffers */
ErtsPSD *psd; /* Rarely used process specific data */ Uint64 bin_vheap_sz; /* Virtual heap block size for binaries */
Uint64 bin_vheap_mature; /* Virtual heap block size for binaries */
Uint64 bin_old_vheap_sz; /* Virtual old heap block size for binaries */
Uint64 bin_old_vheap; /* Virtual old heap size for binaries */ ErtsProcSysTaskQs *sys_task_qs; erts_smp_atomic32_t state; /* Process state flags (see ERTS_PSFLG_*) */ #ifdef ERTS_SMP
ErlMessageInQueue msg_inq;
ErtsPendExit pending_exit;
erts_proc_lock_t lock;
ErtsSchedulerData *scheduler_data;
Eterm suspendee;
ErtsPendingSuspend *pending_suspenders;
erts_smp_atomic_t run_queue;
#ifdef HIPE
struct hipe_process_state_smp hipe_smp;
#endif
#endif #ifdef CHECK_FOR_HOLES
Eterm* last_htop; /* No need to scan the heap below this point. */
ErlHeapFragment* last_mbuf; /* No need to scan beyond this mbuf. */
#endif #ifdef DEBUG
Eterm* last_old_htop; /*
* No need to scan the old heap below this point
* when looking for invalid pointers into the new heap or
* heap fragments.
*/
#endif #ifdef FORCE_HEAP_FRAGS
Uint space_verified; /* Avoid HAlloc forcing heap fragments when */
Eterm* space_verified_from; /* we rely on available heap space (TestHeap) */
#endif
};
[Erlang 0119] Erlang OTP 源码阅读指引的更多相关文章
- JDK 1.8 源码阅读和理解
根据 一篇文章教会你,如何做到招聘要求中的“要有扎实的Java基础” 的指引,决定开始阅读下JDK源码. 本文将作为源码阅读总纲 一.精读部分 java.io java.lang java.util ...
- 【原】FMDB源码阅读(三)
[原]FMDB源码阅读(三) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 FMDB比较优秀的地方就在于对多线程的处理.所以这一篇主要是研究FMDB的多线程处理的实现.而 ...
- 【原】FMDB源码阅读(二)
[原]FMDB源码阅读(二) 本文转载请注明出处 -- polobymulberry-博客园 1. 前言 上一篇只是简单地过了一下FMDB一个简单例子的基本流程,并没有涉及到FMDB的所有方方面面,比 ...
- 【原】FMDB源码阅读(一)
[原]FMDB源码阅读(一) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 说实话,之前的SDWebImage和AFNetworking这两个组件我还是使用过的,但是对于 ...
- 【原】AFNetworking源码阅读(六)
[原]AFNetworking源码阅读(六) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 这一篇的想讲的,一个就是分析一下AFSecurityPolicy文件,看看AF ...
- 【原】AFNetworking源码阅读(五)
[原]AFNetworking源码阅读(五) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 上一篇中提及到了Multipart Request的构建方法- [AFHTTP ...
- 【原】AFNetworking源码阅读(四)
[原]AFNetworking源码阅读(四) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 上一篇还遗留了很多问题,包括AFURLSessionManagerTaskDe ...
- 【原】AFNetworking源码阅读(三)
[原]AFNetworking源码阅读(三) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 上一篇的话,主要是讲了如何通过构建一个request来生成一个data tas ...
- 【原】AFNetworking源码阅读(二)
[原]AFNetworking源码阅读(二) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 上一篇中我们在iOS Example代码中提到了AFHTTPSessionMa ...
随机推荐
- 基于虎书实现LALR(1)分析并生成GLSL编译器前端代码(C#)
基于虎书实现LALR(1)分析并生成GLSL编译器前端代码(C#) 为了完美解析GLSL源码,获取其中的信息(都有哪些in/out/uniform等),我决定做个GLSL编译器的前端(以后简称编译器或 ...
- JavaScript 精粹
数据类型 JavaScript 是 弱类型 语言,但并不是没有类型,JavaScript可以识别下面 7 种不同类型的值: 基本数据类型 Boolean Number String null unde ...
- openresty 前端开发入门六之调试篇
大多数情况下,调试信息,都可以通过ngx.say打印出来,但是有的时候,我们希望打印调试日志,不影响到返回数据,所以系统打印到其它地方,比如日志文件,或者控制台 这里主要用到一个方法就是ngx.log ...
- 基于Caffe的DeepID2实现(下)
小喵的唠叨话:这次的博客,真心累伤了小喵的心.但考虑到知识需要巩固和分享,小喵决定这次把剩下的内容都写完. 小喵的博客:http://www.miaoerduo.com 博客原文: http://ww ...
- 解析大型.NET ERP系统 版本控制
数据库版本控制 1) 开发版本控制.控制多人同时修改数据库产生的冲突,使用SQL Source Control 工具做版本管理. SQL Server Management Studio支持VSS和T ...
- VS2015企业版本(安装包+key)+ .NET Reflector 9.0
Reflector9.0系下载:https://yunpan.cn/cMQj9zWbffSqy 访问密码 55eb VS2015中文企业版: http://pan.baidu.com/s/1eRIo ...
- .NET Core下的日志(3):如何将日志消息输出到控制台上
当我们利用LoggerFactory创建一个Logger对象并利用它来实现日志记录,这个过程会产生一个日志消息,日志消息的流向取决于注册到LoggerFactory之上的LoggerProvider. ...
- 从零开始编写自己的C#框架(23)——上传组件使用说明
文章导航 1.前言 2.上传组件功能说明 3.数据库结构 4.上传配置管理 5.上传组件所使用到的类 6.上传组件调用方法 7.效果演示 8.小结 1.前言 本系列所使用的是上传组件是大神July开发 ...
- MyCat源码分析系列之——结果合并
更多MyCat源码分析,请戳MyCat源码分析系列 结果合并 在SQL下发流程和前后端验证流程中介绍过,通过用户验证的后端连接绑定的NIOHandler是MySQLConnectionHandler实 ...
- 利用fis3自动化处理asp.net项目静态资源时遇到的一个编码问题
fis3是一款强大的前端自动化构建工具,提供了很多非常实用的功能,具体参考http://fis.baidu.com/,使用该工具需要安装node环境. 最近在部署网站的时候尝试了一下使用该工具对前端资 ...