Skip to content

g1 VM_Thread

ceragon edited this page Dec 7, 2021 · 1 revision

VM Thread 线程

声明

  1. 声明位于 vmThread.cpp 中
VMThread::VMThread() : NamedThread() {
    set_name("VM Thread");
}
void VMThread::create() {
    _vm_thread = new VMThread();
}
  1. 创建和启动是在 thread.cpp 中
jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
    VMThread::create();
    Thread* vmthread = VMThread::vm_thread();
    os::create_thread(vmthread, os::vm_thread);
    os::start_thread(vmthread);
}

run 方法

void VMThread::run() {
    this->initialize_named_thread();
    this->loop();
}
void VMThread::loop() {    
    while(true) {
        // 代码省略
    }
}

任务列表

g1 有关的任务

任务名称 位置 备注 解析
VM_G1CollectForAllocation G1CollectedHeap::collect
VM_G1CollectFull G1CollectedHeap::collect
VM_G1CollectForAllocation G1CollectedHeap::do_collection_pause
VM_CGC_Operation::CMRemark G1ConcurrentMarkThread::run_service
VM_CGC_Operation::CMCleanup G1ConcurrentMarkThread::run_service
VM_G1SendHeapRegionInfoEvents G1HeapRegionEventSender::send_events

Clone this wiki locally