• Context Switch：1.x us on my machine(2.5 GHz
Intel Core i7).
• C Struct : erl_process.h
• PCB: process control block
• process id
• stack/heap position
• argument registers
• program counter
• private heap : compound data structures, such as tuples, lists etc.
• heap fragments: used when there is not enough free space in the heap and
garbage collection cannot be performed to get more free memory.
• Reductions: 2000
• erl_vm.h :
• #deﬁne CONTEXT_REDS 2000 /* Swap process out after this number */
• erts_schedule in erl_process.c
• consumes all its reductions
• or pauses to wait for a message
• Four priorities: low | normal | high | max
• Four queues: ports, maximum, high, normal/low.
• ports > max > high > normal/low
• normal/low: skip a low priority process for a number of times
• Round-Robin in queue.
• Check workload periodically by one scheduler
• Default period: 2000*2000 reductions.
• #deﬁne ERTS_RUNQ_CHECK_BALANCE_REDS_PER_SCHED
• check_balance in erl_process.c
• During a period:
• work sharing/stealing
• determines the number of active schedulers for the next period based on
the load of the current period