java并发笔记之java线程模型
java并发笔记之java线程模型java当中的线程和操作系统的线程是什么关系?猜想: java thread —-对应-—> OS thread Linux关于操作系统的线程控制源码:pthread_create()Linux命令:man pthread_create int pthread_create(pthread_t thread, const pthread_attr_t attr, void (start_routine) (void ), void arg); 根据man配置的信息可以得出pthread_create会创建一个线程,这个函数是linux系统的函数,可以用C或者C++直接调用,上面信息也告诉程序员这个函数在pthread.h, 这个函数有四个参数: 然后我们来在linux上启动一个线程的代码: 创建一个后缀名.c的文件: 复制代码//引入头文件 include include //定义一个变量,接受创建线程后的线程idpthread_t pid;//定义子线程的主体函数void thread_entity(void arg){ while (1) {...