操作系统课程中提到了两个非常重要的概念进程和线程,对此进行一下小结!
1.进程
概念:通俗的讲进程就是运行着的程序(A program in execution)
A process is an instance of a computer program, consisting of one or more threads, that is being sequentially executed by a computer system that has the ability to run several computer programs concurrently (Wikipedia)
进程组成:进程控制块、程序段、数据段三部分组成
进程控制块PCB(Process control block)
进程状态(Process states):
新的(new)
运行(running)
等待(waiting)
就绪(ready)
终止(terminated)

2.线程
概念:线程(thread),有时被称为轻量级进程(Lightweight Process,LWP),是程序执行流的最小单元。
A thread of execution results from a fork of a computer program into two or more (Wikipedia)
线程组成:线程ID,程序计数器,寄存器集合和堆栈组成
Java中线程创建的两种方法:
1.继承Thread类
2.实现Runnable接口
本文详细解释了操作系统中进程和线程的概念。进程是正在运行的程序实例,由进程控制块、程序段和数据段组成;线程是程序执行流的最小单位,由线程ID、程序计数器、寄存器集合和堆栈组成。此外,还介绍了Java中创建线程的两种方法。
1万+

被折叠的 条评论
为什么被折叠?



