new Thread(runnable()).start() JVM底层原理分析
2021-10-12 18:54:00 0 举报
Java多线程底层原理
作者其他创作
大纲/内容
INITIALIZED
线程状态流转
(Z:\\gitee\\openjdk\\hotspot\\src\\share\\vm\\prims\\jvm.cpp)--JVM_StartThread
operator new(size_t size)
ALLOCATED
initialize
JavaThread::JavaThread
Thread::start(javaThread);
pd_initialize(); set_start_proc(start_proc); set_start_parm(start_parm); set_interrupted(false);
java_start
Z:\\gitee\\openjdk\\hotspot\\src\\os\\linux\\vm\\os_linux.cpp
osthread->set_state(RUNNABLE);
RUNNABLE
sync_with_child->notify();
Thread::Thread(基类构造函数)
new Thread(runnable()).start()流程
thread->set_osthread(osthread);
pd_start_thread(thread);
java_lang_Thread::stackSize(获取栈参数大小)
os::start_thread(thread);
JVM_StartThread
set_entry_point(entry_point);
thread->run();
唤醒线程
osthread->set_state(INITIALIZED); sync->notify_all(); // sync->wait(Mutex::_no_safepoint_check_flag);//阻塞
0 条评论
下一页