进程的基本状态及转换和阻塞及挂起的理解[通俗易懂]

进程的基本状态及转换和阻塞及挂起的理解[通俗易懂]概念描述:就绪状态:一个进程获得了除处理机外的一切所需资源,一旦得到处理机即可运行,则称此进程处于就绪状态。执行状态:当一个进程在处理机上运行时,则称该进程处于运行状态。阻塞状态:一个进程正在等待某一事件发生(例如请求I/O而等待I/O完成等)而暂时仃止运行,这时即使把处理机分配给进程也无法运行,故称该进程处于阻塞状态。挂起状态:由于IO的速度慢于CPU的运算速度,经常出现CPU等待…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定

概念描述:

  • 就绪状态 :一个进程获得了除处理机外的一切所需资源,一旦得到处理机即可运行,则称此进程处于就绪状态。
  • 执行状态:当一个进程在处理机上运行时,则称该进程处于运行状态。
  • 阻塞状态:一个进程正在等待某一事件发生(例如请求I/O而等待I/O完成等)而暂时仃止运行,这时即使把处理机分配给进程也无法运行,故称该进程处于阻塞状态。
  • 挂起状态:由于IO的速度慢于CPU的运算速度,经常出现CPU等待I/O的情况。这时OS需要将主存中的进程对换至外存。在进程行为模式中需要增加一个新的挂起(suspend)状态。当内存中所有进程阻塞时,OS可将一进程置为挂起态并交换到外存,再调入另一个进程执行。
  • 新建状态:进程刚创建,但还不能运行,OS还没有把它加到可执行进程组中,通常是还没有加载到主存中的新进程。
  • 退出状态:OS从可执行进程组中释放出的进程,或者是因为它自身停止了,或者是因为某种原因被取消。进程不在适合执行,但与作业相关的表和其它信息临时被OS保留起来,为其他程序提供所需信息。
  • 活跃就绪:指进程在主存并旦可被调度的状态。
  • 静止就绪:指进程被对换到辅存时的就绪状态,是不能被直接调度的状态,只有当主存中没有活跃就绪态进程,或者是挂起态进程具有更高的优先级,系统将把挂起就绪态进程调回主存并转换为活跃就绪。
  • 活跃阻塞:指进程在主存中。一旦等待的事件产生,便进入活跃就绪状态。
  • 静止阻塞:指进程对换到辅存时的阻塞状态。一旦等待的事件产生,便进入静止就绪状态。

进程转换状态图

  • 三种基本状态转换图:

#mermaid-svg-u5pQmkv3I0cc1Tvf .label { font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); fill: #333; color: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .label text { fill: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .node rect,#mermaid-svg-u5pQmkv3I0cc1Tvf .node circle,#mermaid-svg-u5pQmkv3I0cc1Tvf .node ellipse,#mermaid-svg-u5pQmkv3I0cc1Tvf .node polygon,#mermaid-svg-u5pQmkv3I0cc1Tvf .node path { fill: #ECECFF; stroke: #9370DB; stroke-width: 1px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .node .label { text-align: center; fill: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .node.clickable { cursor: pointer; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .arrowheadPath { fill: #333333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .edgePath .path { stroke: #333333; stroke-width: 1.5px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .flowchart-link { stroke: #333333; fill: none; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .edgeLabel { background-color: #e8e8e8; text-align: center; }#mermaid-svg-u5pQmkv3I0cc1Tvf .edgeLabel rect { opacity: 0.9; }#mermaid-svg-u5pQmkv3I0cc1Tvf .edgeLabel span { color: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .cluster rect { fill: #ffffde; stroke: #aaaa33; stroke-width: 1px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .cluster text { fill: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf div.mermaidTooltip { position: absolute; text-align: center; max-width: 200px; padding: 2px; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); font-size: 12px; background: #ffffde; border: 1px solid #aaaa33; border-radius: 2px; pointer-events: none; z-index: 100; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .actor { stroke: #CCCCFF; fill: #ECECFF; }

#mermaid-svg-u5pQmkv3I0cc1Tvf text.actor > tspan { fill: black; stroke: none; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .actor-line { stroke: grey; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .messageLine0 { stroke-width: 1.5; stroke-dasharray: none; stroke: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .messageLine1 { stroke-width: 1.5; stroke-dasharray: 2, 2; stroke: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf #arrowhead path { fill: #333; stroke: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .sequenceNumber { fill: white; }

#mermaid-svg-u5pQmkv3I0cc1Tvf #sequencenumber { fill: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf #crosshead path { fill: #333; stroke: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .messageText { fill: #333; stroke: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .labelBox { stroke: #CCCCFF; fill: #ECECFF; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .labelText,#mermaid-svg-u5pQmkv3I0cc1Tvf .labelText > tspan { fill: black; stroke: none; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .loopText,#mermaid-svg-u5pQmkv3I0cc1Tvf .loopText > tspan { fill: black; stroke: none; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .loopLine { stroke-width: 2px; stroke-dasharray: 2, 2; stroke: #CCCCFF; fill: #CCCCFF; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .note { stroke: #aaaa33; fill: #fff5ad; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .noteText,#mermaid-svg-u5pQmkv3I0cc1Tvf .noteText > tspan { fill: black; stroke: none; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .activation0 { fill: #f4f4f4; stroke: #666; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .activation1 { fill: #f4f4f4; stroke: #666; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .activation2 { fill: #f4f4f4; stroke: #666; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .mermaid-main-font { font-family: "trebuchet ms", verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-u5pQmkv3I0cc1Tvf .section { stroke: none; opacity: 0.2; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .section0 { fill: rgba(102, 102, 255, 0.49); }

#mermaid-svg-u5pQmkv3I0cc1Tvf .section2 { fill: #fff400; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .section1,#mermaid-svg-u5pQmkv3I0cc1Tvf .section3 { fill: white; opacity: 0.2; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .sectionTitle0 { fill: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .sectionTitle1 { fill: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .sectionTitle2 { fill: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .sectionTitle3 { fill: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .sectionTitle { text-anchor: start; font-size: 11px; text-height: 14px; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-u5pQmkv3I0cc1Tvf .grid .tick { stroke: lightgrey; opacity: 0.8; shape-rendering: crispEdges; }#mermaid-svg-u5pQmkv3I0cc1Tvf .grid .tick text { font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-u5pQmkv3I0cc1Tvf .grid path { stroke-width: 0; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .today { fill: none; stroke: red; stroke-width: 2px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .task { stroke-width: 2; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .taskText { text-anchor: middle; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-u5pQmkv3I0cc1Tvf .taskText:not([font-size]) { font-size: 11px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .taskTextOutsideRight { fill: black; text-anchor: start; font-size: 11px; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-u5pQmkv3I0cc1Tvf .taskTextOutsideLeft { fill: black; text-anchor: end; font-size: 11px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .task.clickable { cursor: pointer; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .taskText.clickable { cursor: pointer; fill: #003163 !important; font-weight: bold; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .taskTextOutsideLeft.clickable { cursor: pointer; fill: #003163 !important; font-weight: bold; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .taskTextOutsideRight.clickable { cursor: pointer; fill: #003163 !important; font-weight: bold; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .taskText0,#mermaid-svg-u5pQmkv3I0cc1Tvf .taskText1,#mermaid-svg-u5pQmkv3I0cc1Tvf .taskText2,#mermaid-svg-u5pQmkv3I0cc1Tvf .taskText3 { fill: white; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .task0,#mermaid-svg-u5pQmkv3I0cc1Tvf .task1,#mermaid-svg-u5pQmkv3I0cc1Tvf .task2,#mermaid-svg-u5pQmkv3I0cc1Tvf .task3 { fill: #8a90dd; stroke: #534fbc; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .taskTextOutside0,#mermaid-svg-u5pQmkv3I0cc1Tvf .taskTextOutside2 { fill: black; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .taskTextOutside1,#mermaid-svg-u5pQmkv3I0cc1Tvf .taskTextOutside3 { fill: black; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .active0,#mermaid-svg-u5pQmkv3I0cc1Tvf .active1,#mermaid-svg-u5pQmkv3I0cc1Tvf .active2,#mermaid-svg-u5pQmkv3I0cc1Tvf .active3 { fill: #bfc7ff; stroke: #534fbc; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .activeText0,#mermaid-svg-u5pQmkv3I0cc1Tvf .activeText1,#mermaid-svg-u5pQmkv3I0cc1Tvf .activeText2,#mermaid-svg-u5pQmkv3I0cc1Tvf .activeText3 { fill: black !important; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .done0,#mermaid-svg-u5pQmkv3I0cc1Tvf .done1,#mermaid-svg-u5pQmkv3I0cc1Tvf .done2,#mermaid-svg-u5pQmkv3I0cc1Tvf .done3 { stroke: grey; fill: lightgrey; stroke-width: 2; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .doneText0,#mermaid-svg-u5pQmkv3I0cc1Tvf .doneText1,#mermaid-svg-u5pQmkv3I0cc1Tvf .doneText2,#mermaid-svg-u5pQmkv3I0cc1Tvf .doneText3 { fill: black !important; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .crit0,#mermaid-svg-u5pQmkv3I0cc1Tvf .crit1,#mermaid-svg-u5pQmkv3I0cc1Tvf .crit2,#mermaid-svg-u5pQmkv3I0cc1Tvf .crit3 { stroke: #ff8888; fill: red; stroke-width: 2; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .activeCrit0,#mermaid-svg-u5pQmkv3I0cc1Tvf .activeCrit1,#mermaid-svg-u5pQmkv3I0cc1Tvf .activeCrit2,#mermaid-svg-u5pQmkv3I0cc1Tvf .activeCrit3 { stroke: #ff8888; fill: #bfc7ff; stroke-width: 2; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .doneCrit0,#mermaid-svg-u5pQmkv3I0cc1Tvf .doneCrit1,#mermaid-svg-u5pQmkv3I0cc1Tvf .doneCrit2,#mermaid-svg-u5pQmkv3I0cc1Tvf .doneCrit3 { stroke: #ff8888; fill: lightgrey; stroke-width: 2; cursor: pointer; shape-rendering: crispEdges; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .milestone { transform: rotate(45deg) scale(0.8, 0.8); }

#mermaid-svg-u5pQmkv3I0cc1Tvf .milestoneText { font-style: italic; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .doneCritText0,#mermaid-svg-u5pQmkv3I0cc1Tvf .doneCritText1,#mermaid-svg-u5pQmkv3I0cc1Tvf .doneCritText2,#mermaid-svg-u5pQmkv3I0cc1Tvf .doneCritText3 { fill: black !important; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .activeCritText0,#mermaid-svg-u5pQmkv3I0cc1Tvf .activeCritText1,#mermaid-svg-u5pQmkv3I0cc1Tvf .activeCritText2,#mermaid-svg-u5pQmkv3I0cc1Tvf .activeCritText3 { fill: black !important; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .titleText { text-anchor: middle; font-size: 18px; fill: black; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-u5pQmkv3I0cc1Tvf g.classGroup text { fill: #9370DB; stroke: none; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); font-size: 10px; }#mermaid-svg-u5pQmkv3I0cc1Tvf g.classGroup text .title { font-weight: bolder; }

#mermaid-svg-u5pQmkv3I0cc1Tvf g.clickable { cursor: pointer; }

#mermaid-svg-u5pQmkv3I0cc1Tvf g.classGroup rect { fill: #ECECFF; stroke: #9370DB; }

#mermaid-svg-u5pQmkv3I0cc1Tvf g.classGroup line { stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .classLabel .box { stroke: none; stroke-width: 0; fill: #ECECFF; opacity: 0.5; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .classLabel .label { fill: #9370DB; font-size: 10px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .relation { stroke: #9370DB; stroke-width: 1; fill: none; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .dashed-line { stroke-dasharray: 3; }

#mermaid-svg-u5pQmkv3I0cc1Tvf #compositionStart { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-u5pQmkv3I0cc1Tvf #compositionEnd { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-u5pQmkv3I0cc1Tvf #aggregationStart { fill: #ECECFF; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-u5pQmkv3I0cc1Tvf #aggregationEnd { fill: #ECECFF; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-u5pQmkv3I0cc1Tvf #dependencyStart { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-u5pQmkv3I0cc1Tvf #dependencyEnd { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-u5pQmkv3I0cc1Tvf #extensionStart { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-u5pQmkv3I0cc1Tvf #extensionEnd { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .commit-id,#mermaid-svg-u5pQmkv3I0cc1Tvf .commit-msg,#mermaid-svg-u5pQmkv3I0cc1Tvf .branch-label { fill: lightgrey; color: lightgrey; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-u5pQmkv3I0cc1Tvf .pieTitleText { text-anchor: middle; font-size: 25px; fill: black; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-u5pQmkv3I0cc1Tvf .slice { font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-u5pQmkv3I0cc1Tvf g.stateGroup text { fill: #9370DB; stroke: none; font-size: 10px; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-u5pQmkv3I0cc1Tvf g.stateGroup text { fill: #9370DB; fill: #333; stroke: none; font-size: 10px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf g.statediagram-cluster .cluster-label text { fill: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf g.stateGroup .state-title { font-weight: bolder; fill: black; }

#mermaid-svg-u5pQmkv3I0cc1Tvf g.stateGroup rect { fill: #ECECFF; stroke: #9370DB; }

#mermaid-svg-u5pQmkv3I0cc1Tvf g.stateGroup line { stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .transition { stroke: #9370DB; stroke-width: 1; fill: none; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .stateGroup .composit { fill: white; border-bottom: 1px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .stateGroup .alt-composit { fill: #e0e0e0; border-bottom: 1px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .state-note { stroke: #aaaa33; fill: #fff5ad; }#mermaid-svg-u5pQmkv3I0cc1Tvf .state-note text { fill: black; stroke: none; font-size: 10px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .stateLabel .box { stroke: none; stroke-width: 0; fill: #ECECFF; opacity: 0.7; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .edgeLabel text { fill: #333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .stateLabel text { fill: black; font-size: 10px; font-weight: bold; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-u5pQmkv3I0cc1Tvf .node circle.state-start { fill: black; stroke: black; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .node circle.state-end { fill: black; stroke: white; stroke-width: 1.5; }

#mermaid-svg-u5pQmkv3I0cc1Tvf #statediagram-barbEnd { fill: #9370DB; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .statediagram-cluster rect { fill: #ECECFF; stroke: #9370DB; stroke-width: 1px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .statediagram-cluster rect.outer { rx: 5px; ry: 5px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .statediagram-state .divider { stroke: #9370DB; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .statediagram-state .title-state { rx: 5px; ry: 5px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .statediagram-cluster.statediagram-cluster .inner { fill: white; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .statediagram-cluster.statediagram-cluster-alt .inner { fill: #e0e0e0; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .statediagram-cluster .inner { rx: 0; ry: 0; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .statediagram-state rect.basic { rx: 5px; ry: 5px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .statediagram-state rect.divider { stroke-dasharray: 10,10; fill: #efefef; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .note-edge { stroke-dasharray: 5; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .statediagram-note rect { fill: #fff5ad; stroke: #aaaa33; stroke-width: 1px; rx: 0; ry: 0; }

:root { --mermaid-font-family: '"trebuchet ms", verdana, arial'; --mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .error-icon { fill: #552222; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .error-text { fill: #552222; stroke: #552222; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .edge-thickness-normal { stroke-width: 2px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .edge-thickness-thick { stroke-width: 3.5px; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .edge-pattern-solid { stroke-dasharray: 0; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .edge-pattern-dashed { stroke-dasharray: 3; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .edge-pattern-dotted { stroke-dasharray: 2; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .marker { fill: #333333; }

#mermaid-svg-u5pQmkv3I0cc1Tvf .marker.cross { stroke: #333333; }

:root { --mermaid-font-family: "trebuchet ms", verdana, arial;}

就绪 执行 阻塞 进程调度 时间片用完 I/O请求 I/O完成 就绪 执行 阻塞

这里写图片描述

  • 五种基本状态转换图(单挂起):

#mermaid-svg-6oBoqCRpu8LGZq1M .label { font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); fill: #333; color: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .label text { fill: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .node rect,#mermaid-svg-6oBoqCRpu8LGZq1M .node circle,#mermaid-svg-6oBoqCRpu8LGZq1M .node ellipse,#mermaid-svg-6oBoqCRpu8LGZq1M .node polygon,#mermaid-svg-6oBoqCRpu8LGZq1M .node path { fill: #ECECFF; stroke: #9370DB; stroke-width: 1px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .node .label { text-align: center; fill: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .node.clickable { cursor: pointer; }

#mermaid-svg-6oBoqCRpu8LGZq1M .arrowheadPath { fill: #333333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .edgePath .path { stroke: #333333; stroke-width: 1.5px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .flowchart-link { stroke: #333333; fill: none; }

#mermaid-svg-6oBoqCRpu8LGZq1M .edgeLabel { background-color: #e8e8e8; text-align: center; }#mermaid-svg-6oBoqCRpu8LGZq1M .edgeLabel rect { opacity: 0.9; }#mermaid-svg-6oBoqCRpu8LGZq1M .edgeLabel span { color: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .cluster rect { fill: #ffffde; stroke: #aaaa33; stroke-width: 1px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .cluster text { fill: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M div.mermaidTooltip { position: absolute; text-align: center; max-width: 200px; padding: 2px; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); font-size: 12px; background: #ffffde; border: 1px solid #aaaa33; border-radius: 2px; pointer-events: none; z-index: 100; }

#mermaid-svg-6oBoqCRpu8LGZq1M .actor { stroke: #CCCCFF; fill: #ECECFF; }

#mermaid-svg-6oBoqCRpu8LGZq1M text.actor > tspan { fill: black; stroke: none; }

#mermaid-svg-6oBoqCRpu8LGZq1M .actor-line { stroke: grey; }

#mermaid-svg-6oBoqCRpu8LGZq1M .messageLine0 { stroke-width: 1.5; stroke-dasharray: none; stroke: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .messageLine1 { stroke-width: 1.5; stroke-dasharray: 2, 2; stroke: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M #arrowhead path { fill: #333; stroke: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .sequenceNumber { fill: white; }

#mermaid-svg-6oBoqCRpu8LGZq1M #sequencenumber { fill: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M #crosshead path { fill: #333; stroke: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .messageText { fill: #333; stroke: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .labelBox { stroke: #CCCCFF; fill: #ECECFF; }

#mermaid-svg-6oBoqCRpu8LGZq1M .labelText,#mermaid-svg-6oBoqCRpu8LGZq1M .labelText > tspan { fill: black; stroke: none; }

#mermaid-svg-6oBoqCRpu8LGZq1M .loopText,#mermaid-svg-6oBoqCRpu8LGZq1M .loopText > tspan { fill: black; stroke: none; }

#mermaid-svg-6oBoqCRpu8LGZq1M .loopLine { stroke-width: 2px; stroke-dasharray: 2, 2; stroke: #CCCCFF; fill: #CCCCFF; }

#mermaid-svg-6oBoqCRpu8LGZq1M .note { stroke: #aaaa33; fill: #fff5ad; }

#mermaid-svg-6oBoqCRpu8LGZq1M .noteText,#mermaid-svg-6oBoqCRpu8LGZq1M .noteText > tspan { fill: black; stroke: none; }

#mermaid-svg-6oBoqCRpu8LGZq1M .activation0 { fill: #f4f4f4; stroke: #666; }

#mermaid-svg-6oBoqCRpu8LGZq1M .activation1 { fill: #f4f4f4; stroke: #666; }

#mermaid-svg-6oBoqCRpu8LGZq1M .activation2 { fill: #f4f4f4; stroke: #666; }

#mermaid-svg-6oBoqCRpu8LGZq1M .mermaid-main-font { font-family: "trebuchet ms", verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-6oBoqCRpu8LGZq1M .section { stroke: none; opacity: 0.2; }

#mermaid-svg-6oBoqCRpu8LGZq1M .section0 { fill: rgba(102, 102, 255, 0.49); }

#mermaid-svg-6oBoqCRpu8LGZq1M .section2 { fill: #fff400; }

#mermaid-svg-6oBoqCRpu8LGZq1M .section1,#mermaid-svg-6oBoqCRpu8LGZq1M .section3 { fill: white; opacity: 0.2; }

#mermaid-svg-6oBoqCRpu8LGZq1M .sectionTitle0 { fill: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .sectionTitle1 { fill: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .sectionTitle2 { fill: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .sectionTitle3 { fill: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .sectionTitle { text-anchor: start; font-size: 11px; text-height: 14px; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-6oBoqCRpu8LGZq1M .grid .tick { stroke: lightgrey; opacity: 0.8; shape-rendering: crispEdges; }#mermaid-svg-6oBoqCRpu8LGZq1M .grid .tick text { font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-6oBoqCRpu8LGZq1M .grid path { stroke-width: 0; }

#mermaid-svg-6oBoqCRpu8LGZq1M .today { fill: none; stroke: red; stroke-width: 2px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .task { stroke-width: 2; }

#mermaid-svg-6oBoqCRpu8LGZq1M .taskText { text-anchor: middle; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-6oBoqCRpu8LGZq1M .taskText:not([font-size]) { font-size: 11px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .taskTextOutsideRight { fill: black; text-anchor: start; font-size: 11px; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-6oBoqCRpu8LGZq1M .taskTextOutsideLeft { fill: black; text-anchor: end; font-size: 11px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .task.clickable { cursor: pointer; }

#mermaid-svg-6oBoqCRpu8LGZq1M .taskText.clickable { cursor: pointer; fill: #003163 !important; font-weight: bold; }

#mermaid-svg-6oBoqCRpu8LGZq1M .taskTextOutsideLeft.clickable { cursor: pointer; fill: #003163 !important; font-weight: bold; }

#mermaid-svg-6oBoqCRpu8LGZq1M .taskTextOutsideRight.clickable { cursor: pointer; fill: #003163 !important; font-weight: bold; }

#mermaid-svg-6oBoqCRpu8LGZq1M .taskText0,#mermaid-svg-6oBoqCRpu8LGZq1M .taskText1,#mermaid-svg-6oBoqCRpu8LGZq1M .taskText2,#mermaid-svg-6oBoqCRpu8LGZq1M .taskText3 { fill: white; }

#mermaid-svg-6oBoqCRpu8LGZq1M .task0,#mermaid-svg-6oBoqCRpu8LGZq1M .task1,#mermaid-svg-6oBoqCRpu8LGZq1M .task2,#mermaid-svg-6oBoqCRpu8LGZq1M .task3 { fill: #8a90dd; stroke: #534fbc; }

#mermaid-svg-6oBoqCRpu8LGZq1M .taskTextOutside0,#mermaid-svg-6oBoqCRpu8LGZq1M .taskTextOutside2 { fill: black; }

#mermaid-svg-6oBoqCRpu8LGZq1M .taskTextOutside1,#mermaid-svg-6oBoqCRpu8LGZq1M .taskTextOutside3 { fill: black; }

#mermaid-svg-6oBoqCRpu8LGZq1M .active0,#mermaid-svg-6oBoqCRpu8LGZq1M .active1,#mermaid-svg-6oBoqCRpu8LGZq1M .active2,#mermaid-svg-6oBoqCRpu8LGZq1M .active3 { fill: #bfc7ff; stroke: #534fbc; }

#mermaid-svg-6oBoqCRpu8LGZq1M .activeText0,#mermaid-svg-6oBoqCRpu8LGZq1M .activeText1,#mermaid-svg-6oBoqCRpu8LGZq1M .activeText2,#mermaid-svg-6oBoqCRpu8LGZq1M .activeText3 { fill: black !important; }

#mermaid-svg-6oBoqCRpu8LGZq1M .done0,#mermaid-svg-6oBoqCRpu8LGZq1M .done1,#mermaid-svg-6oBoqCRpu8LGZq1M .done2,#mermaid-svg-6oBoqCRpu8LGZq1M .done3 { stroke: grey; fill: lightgrey; stroke-width: 2; }

#mermaid-svg-6oBoqCRpu8LGZq1M .doneText0,#mermaid-svg-6oBoqCRpu8LGZq1M .doneText1,#mermaid-svg-6oBoqCRpu8LGZq1M .doneText2,#mermaid-svg-6oBoqCRpu8LGZq1M .doneText3 { fill: black !important; }

#mermaid-svg-6oBoqCRpu8LGZq1M .crit0,#mermaid-svg-6oBoqCRpu8LGZq1M .crit1,#mermaid-svg-6oBoqCRpu8LGZq1M .crit2,#mermaid-svg-6oBoqCRpu8LGZq1M .crit3 { stroke: #ff8888; fill: red; stroke-width: 2; }

#mermaid-svg-6oBoqCRpu8LGZq1M .activeCrit0,#mermaid-svg-6oBoqCRpu8LGZq1M .activeCrit1,#mermaid-svg-6oBoqCRpu8LGZq1M .activeCrit2,#mermaid-svg-6oBoqCRpu8LGZq1M .activeCrit3 { stroke: #ff8888; fill: #bfc7ff; stroke-width: 2; }

#mermaid-svg-6oBoqCRpu8LGZq1M .doneCrit0,#mermaid-svg-6oBoqCRpu8LGZq1M .doneCrit1,#mermaid-svg-6oBoqCRpu8LGZq1M .doneCrit2,#mermaid-svg-6oBoqCRpu8LGZq1M .doneCrit3 { stroke: #ff8888; fill: lightgrey; stroke-width: 2; cursor: pointer; shape-rendering: crispEdges; }

#mermaid-svg-6oBoqCRpu8LGZq1M .milestone { transform: rotate(45deg) scale(0.8, 0.8); }

#mermaid-svg-6oBoqCRpu8LGZq1M .milestoneText { font-style: italic; }

#mermaid-svg-6oBoqCRpu8LGZq1M .doneCritText0,#mermaid-svg-6oBoqCRpu8LGZq1M .doneCritText1,#mermaid-svg-6oBoqCRpu8LGZq1M .doneCritText2,#mermaid-svg-6oBoqCRpu8LGZq1M .doneCritText3 { fill: black !important; }

#mermaid-svg-6oBoqCRpu8LGZq1M .activeCritText0,#mermaid-svg-6oBoqCRpu8LGZq1M .activeCritText1,#mermaid-svg-6oBoqCRpu8LGZq1M .activeCritText2,#mermaid-svg-6oBoqCRpu8LGZq1M .activeCritText3 { fill: black !important; }

#mermaid-svg-6oBoqCRpu8LGZq1M .titleText { text-anchor: middle; font-size: 18px; fill: black; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-6oBoqCRpu8LGZq1M g.classGroup text { fill: #9370DB; stroke: none; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); font-size: 10px; }#mermaid-svg-6oBoqCRpu8LGZq1M g.classGroup text .title { font-weight: bolder; }

#mermaid-svg-6oBoqCRpu8LGZq1M g.clickable { cursor: pointer; }

#mermaid-svg-6oBoqCRpu8LGZq1M g.classGroup rect { fill: #ECECFF; stroke: #9370DB; }

#mermaid-svg-6oBoqCRpu8LGZq1M g.classGroup line { stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-6oBoqCRpu8LGZq1M .classLabel .box { stroke: none; stroke-width: 0; fill: #ECECFF; opacity: 0.5; }

#mermaid-svg-6oBoqCRpu8LGZq1M .classLabel .label { fill: #9370DB; font-size: 10px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .relation { stroke: #9370DB; stroke-width: 1; fill: none; }

#mermaid-svg-6oBoqCRpu8LGZq1M .dashed-line { stroke-dasharray: 3; }

#mermaid-svg-6oBoqCRpu8LGZq1M #compositionStart { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-6oBoqCRpu8LGZq1M #compositionEnd { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-6oBoqCRpu8LGZq1M #aggregationStart { fill: #ECECFF; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-6oBoqCRpu8LGZq1M #aggregationEnd { fill: #ECECFF; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-6oBoqCRpu8LGZq1M #dependencyStart { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-6oBoqCRpu8LGZq1M #dependencyEnd { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-6oBoqCRpu8LGZq1M #extensionStart { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-6oBoqCRpu8LGZq1M #extensionEnd { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-6oBoqCRpu8LGZq1M .commit-id,#mermaid-svg-6oBoqCRpu8LGZq1M .commit-msg,#mermaid-svg-6oBoqCRpu8LGZq1M .branch-label { fill: lightgrey; color: lightgrey; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-6oBoqCRpu8LGZq1M .pieTitleText { text-anchor: middle; font-size: 25px; fill: black; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-6oBoqCRpu8LGZq1M .slice { font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-6oBoqCRpu8LGZq1M g.stateGroup text { fill: #9370DB; stroke: none; font-size: 10px; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-6oBoqCRpu8LGZq1M g.stateGroup text { fill: #9370DB; fill: #333; stroke: none; font-size: 10px; }

#mermaid-svg-6oBoqCRpu8LGZq1M g.statediagram-cluster .cluster-label text { fill: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M g.stateGroup .state-title { font-weight: bolder; fill: black; }

#mermaid-svg-6oBoqCRpu8LGZq1M g.stateGroup rect { fill: #ECECFF; stroke: #9370DB; }

#mermaid-svg-6oBoqCRpu8LGZq1M g.stateGroup line { stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-6oBoqCRpu8LGZq1M .transition { stroke: #9370DB; stroke-width: 1; fill: none; }

#mermaid-svg-6oBoqCRpu8LGZq1M .stateGroup .composit { fill: white; border-bottom: 1px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .stateGroup .alt-composit { fill: #e0e0e0; border-bottom: 1px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .state-note { stroke: #aaaa33; fill: #fff5ad; }#mermaid-svg-6oBoqCRpu8LGZq1M .state-note text { fill: black; stroke: none; font-size: 10px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .stateLabel .box { stroke: none; stroke-width: 0; fill: #ECECFF; opacity: 0.7; }

#mermaid-svg-6oBoqCRpu8LGZq1M .edgeLabel text { fill: #333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .stateLabel text { fill: black; font-size: 10px; font-weight: bold; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-6oBoqCRpu8LGZq1M .node circle.state-start { fill: black; stroke: black; }

#mermaid-svg-6oBoqCRpu8LGZq1M .node circle.state-end { fill: black; stroke: white; stroke-width: 1.5; }

#mermaid-svg-6oBoqCRpu8LGZq1M #statediagram-barbEnd { fill: #9370DB; }

#mermaid-svg-6oBoqCRpu8LGZq1M .statediagram-cluster rect { fill: #ECECFF; stroke: #9370DB; stroke-width: 1px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .statediagram-cluster rect.outer { rx: 5px; ry: 5px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .statediagram-state .divider { stroke: #9370DB; }

#mermaid-svg-6oBoqCRpu8LGZq1M .statediagram-state .title-state { rx: 5px; ry: 5px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .statediagram-cluster.statediagram-cluster .inner { fill: white; }

#mermaid-svg-6oBoqCRpu8LGZq1M .statediagram-cluster.statediagram-cluster-alt .inner { fill: #e0e0e0; }

#mermaid-svg-6oBoqCRpu8LGZq1M .statediagram-cluster .inner { rx: 0; ry: 0; }

#mermaid-svg-6oBoqCRpu8LGZq1M .statediagram-state rect.basic { rx: 5px; ry: 5px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .statediagram-state rect.divider { stroke-dasharray: 10,10; fill: #efefef; }

#mermaid-svg-6oBoqCRpu8LGZq1M .note-edge { stroke-dasharray: 5; }

#mermaid-svg-6oBoqCRpu8LGZq1M .statediagram-note rect { fill: #fff5ad; stroke: #aaaa33; stroke-width: 1px; rx: 0; ry: 0; }

:root { --mermaid-font-family: '"trebuchet ms", verdana, arial'; --mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive; }

#mermaid-svg-6oBoqCRpu8LGZq1M .error-icon { fill: #552222; }

#mermaid-svg-6oBoqCRpu8LGZq1M .error-text { fill: #552222; stroke: #552222; }

#mermaid-svg-6oBoqCRpu8LGZq1M .edge-thickness-normal { stroke-width: 2px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .edge-thickness-thick { stroke-width: 3.5px; }

#mermaid-svg-6oBoqCRpu8LGZq1M .edge-pattern-solid { stroke-dasharray: 0; }

#mermaid-svg-6oBoqCRpu8LGZq1M .edge-pattern-dashed { stroke-dasharray: 3; }

#mermaid-svg-6oBoqCRpu8LGZq1M .edge-pattern-dotted { stroke-dasharray: 2; }

#mermaid-svg-6oBoqCRpu8LGZq1M .marker { fill: #333333; }

#mermaid-svg-6oBoqCRpu8LGZq1M .marker.cross { stroke: #333333; }

:root { --mermaid-font-family: "trebuchet ms", verdana, arial;}

新建 就绪 执行 阻塞 挂起 退出 允许进入 分派 时间片用完(超时) 事件等待(I/O请求) 事件发生(I/O完成) 挂起 激活 释放 新建 就绪 执行 阻塞 挂起 退出

这里写图片描述

  • 五种基本状态转换图(双挂起):

#mermaid-svg-y4Xz2W1EqKEjdPHA .label { font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); fill: #333; color: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .label text { fill: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .node rect,#mermaid-svg-y4Xz2W1EqKEjdPHA .node circle,#mermaid-svg-y4Xz2W1EqKEjdPHA .node ellipse,#mermaid-svg-y4Xz2W1EqKEjdPHA .node polygon,#mermaid-svg-y4Xz2W1EqKEjdPHA .node path { fill: #ECECFF; stroke: #9370DB; stroke-width: 1px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .node .label { text-align: center; fill: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .node.clickable { cursor: pointer; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .arrowheadPath { fill: #333333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .edgePath .path { stroke: #333333; stroke-width: 1.5px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .flowchart-link { stroke: #333333; fill: none; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .edgeLabel { background-color: #e8e8e8; text-align: center; }#mermaid-svg-y4Xz2W1EqKEjdPHA .edgeLabel rect { opacity: 0.9; }#mermaid-svg-y4Xz2W1EqKEjdPHA .edgeLabel span { color: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .cluster rect { fill: #ffffde; stroke: #aaaa33; stroke-width: 1px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .cluster text { fill: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA div.mermaidTooltip { position: absolute; text-align: center; max-width: 200px; padding: 2px; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); font-size: 12px; background: #ffffde; border: 1px solid #aaaa33; border-radius: 2px; pointer-events: none; z-index: 100; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .actor { stroke: #CCCCFF; fill: #ECECFF; }

#mermaid-svg-y4Xz2W1EqKEjdPHA text.actor > tspan { fill: black; stroke: none; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .actor-line { stroke: grey; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .messageLine0 { stroke-width: 1.5; stroke-dasharray: none; stroke: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .messageLine1 { stroke-width: 1.5; stroke-dasharray: 2, 2; stroke: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA #arrowhead path { fill: #333; stroke: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .sequenceNumber { fill: white; }

#mermaid-svg-y4Xz2W1EqKEjdPHA #sequencenumber { fill: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA #crosshead path { fill: #333; stroke: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .messageText { fill: #333; stroke: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .labelBox { stroke: #CCCCFF; fill: #ECECFF; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .labelText,#mermaid-svg-y4Xz2W1EqKEjdPHA .labelText > tspan { fill: black; stroke: none; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .loopText,#mermaid-svg-y4Xz2W1EqKEjdPHA .loopText > tspan { fill: black; stroke: none; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .loopLine { stroke-width: 2px; stroke-dasharray: 2, 2; stroke: #CCCCFF; fill: #CCCCFF; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .note { stroke: #aaaa33; fill: #fff5ad; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .noteText,#mermaid-svg-y4Xz2W1EqKEjdPHA .noteText > tspan { fill: black; stroke: none; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .activation0 { fill: #f4f4f4; stroke: #666; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .activation1 { fill: #f4f4f4; stroke: #666; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .activation2 { fill: #f4f4f4; stroke: #666; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .mermaid-main-font { font-family: "trebuchet ms", verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-y4Xz2W1EqKEjdPHA .section { stroke: none; opacity: 0.2; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .section0 { fill: rgba(102, 102, 255, 0.49); }

#mermaid-svg-y4Xz2W1EqKEjdPHA .section2 { fill: #fff400; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .section1,#mermaid-svg-y4Xz2W1EqKEjdPHA .section3 { fill: white; opacity: 0.2; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .sectionTitle0 { fill: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .sectionTitle1 { fill: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .sectionTitle2 { fill: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .sectionTitle3 { fill: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .sectionTitle { text-anchor: start; font-size: 11px; text-height: 14px; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-y4Xz2W1EqKEjdPHA .grid .tick { stroke: lightgrey; opacity: 0.8; shape-rendering: crispEdges; }#mermaid-svg-y4Xz2W1EqKEjdPHA .grid .tick text { font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-y4Xz2W1EqKEjdPHA .grid path { stroke-width: 0; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .today { fill: none; stroke: red; stroke-width: 2px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .task { stroke-width: 2; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .taskText { text-anchor: middle; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-y4Xz2W1EqKEjdPHA .taskText:not([font-size]) { font-size: 11px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .taskTextOutsideRight { fill: black; text-anchor: start; font-size: 11px; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-y4Xz2W1EqKEjdPHA .taskTextOutsideLeft { fill: black; text-anchor: end; font-size: 11px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .task.clickable { cursor: pointer; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .taskText.clickable { cursor: pointer; fill: #003163 !important; font-weight: bold; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .taskTextOutsideLeft.clickable { cursor: pointer; fill: #003163 !important; font-weight: bold; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .taskTextOutsideRight.clickable { cursor: pointer; fill: #003163 !important; font-weight: bold; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .taskText0,#mermaid-svg-y4Xz2W1EqKEjdPHA .taskText1,#mermaid-svg-y4Xz2W1EqKEjdPHA .taskText2,#mermaid-svg-y4Xz2W1EqKEjdPHA .taskText3 { fill: white; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .task0,#mermaid-svg-y4Xz2W1EqKEjdPHA .task1,#mermaid-svg-y4Xz2W1EqKEjdPHA .task2,#mermaid-svg-y4Xz2W1EqKEjdPHA .task3 { fill: #8a90dd; stroke: #534fbc; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .taskTextOutside0,#mermaid-svg-y4Xz2W1EqKEjdPHA .taskTextOutside2 { fill: black; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .taskTextOutside1,#mermaid-svg-y4Xz2W1EqKEjdPHA .taskTextOutside3 { fill: black; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .active0,#mermaid-svg-y4Xz2W1EqKEjdPHA .active1,#mermaid-svg-y4Xz2W1EqKEjdPHA .active2,#mermaid-svg-y4Xz2W1EqKEjdPHA .active3 { fill: #bfc7ff; stroke: #534fbc; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .activeText0,#mermaid-svg-y4Xz2W1EqKEjdPHA .activeText1,#mermaid-svg-y4Xz2W1EqKEjdPHA .activeText2,#mermaid-svg-y4Xz2W1EqKEjdPHA .activeText3 { fill: black !important; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .done0,#mermaid-svg-y4Xz2W1EqKEjdPHA .done1,#mermaid-svg-y4Xz2W1EqKEjdPHA .done2,#mermaid-svg-y4Xz2W1EqKEjdPHA .done3 { stroke: grey; fill: lightgrey; stroke-width: 2; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .doneText0,#mermaid-svg-y4Xz2W1EqKEjdPHA .doneText1,#mermaid-svg-y4Xz2W1EqKEjdPHA .doneText2,#mermaid-svg-y4Xz2W1EqKEjdPHA .doneText3 { fill: black !important; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .crit0,#mermaid-svg-y4Xz2W1EqKEjdPHA .crit1,#mermaid-svg-y4Xz2W1EqKEjdPHA .crit2,#mermaid-svg-y4Xz2W1EqKEjdPHA .crit3 { stroke: #ff8888; fill: red; stroke-width: 2; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .activeCrit0,#mermaid-svg-y4Xz2W1EqKEjdPHA .activeCrit1,#mermaid-svg-y4Xz2W1EqKEjdPHA .activeCrit2,#mermaid-svg-y4Xz2W1EqKEjdPHA .activeCrit3 { stroke: #ff8888; fill: #bfc7ff; stroke-width: 2; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .doneCrit0,#mermaid-svg-y4Xz2W1EqKEjdPHA .doneCrit1,#mermaid-svg-y4Xz2W1EqKEjdPHA .doneCrit2,#mermaid-svg-y4Xz2W1EqKEjdPHA .doneCrit3 { stroke: #ff8888; fill: lightgrey; stroke-width: 2; cursor: pointer; shape-rendering: crispEdges; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .milestone { transform: rotate(45deg) scale(0.8, 0.8); }

#mermaid-svg-y4Xz2W1EqKEjdPHA .milestoneText { font-style: italic; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .doneCritText0,#mermaid-svg-y4Xz2W1EqKEjdPHA .doneCritText1,#mermaid-svg-y4Xz2W1EqKEjdPHA .doneCritText2,#mermaid-svg-y4Xz2W1EqKEjdPHA .doneCritText3 { fill: black !important; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .activeCritText0,#mermaid-svg-y4Xz2W1EqKEjdPHA .activeCritText1,#mermaid-svg-y4Xz2W1EqKEjdPHA .activeCritText2,#mermaid-svg-y4Xz2W1EqKEjdPHA .activeCritText3 { fill: black !important; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .titleText { text-anchor: middle; font-size: 18px; fill: black; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-y4Xz2W1EqKEjdPHA g.classGroup text { fill: #9370DB; stroke: none; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); font-size: 10px; }#mermaid-svg-y4Xz2W1EqKEjdPHA g.classGroup text .title { font-weight: bolder; }

#mermaid-svg-y4Xz2W1EqKEjdPHA g.clickable { cursor: pointer; }

#mermaid-svg-y4Xz2W1EqKEjdPHA g.classGroup rect { fill: #ECECFF; stroke: #9370DB; }

#mermaid-svg-y4Xz2W1EqKEjdPHA g.classGroup line { stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .classLabel .box { stroke: none; stroke-width: 0; fill: #ECECFF; opacity: 0.5; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .classLabel .label { fill: #9370DB; font-size: 10px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .relation { stroke: #9370DB; stroke-width: 1; fill: none; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .dashed-line { stroke-dasharray: 3; }

#mermaid-svg-y4Xz2W1EqKEjdPHA #compositionStart { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-y4Xz2W1EqKEjdPHA #compositionEnd { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-y4Xz2W1EqKEjdPHA #aggregationStart { fill: #ECECFF; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-y4Xz2W1EqKEjdPHA #aggregationEnd { fill: #ECECFF; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-y4Xz2W1EqKEjdPHA #dependencyStart { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-y4Xz2W1EqKEjdPHA #dependencyEnd { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-y4Xz2W1EqKEjdPHA #extensionStart { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-y4Xz2W1EqKEjdPHA #extensionEnd { fill: #9370DB; stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .commit-id,#mermaid-svg-y4Xz2W1EqKEjdPHA .commit-msg,#mermaid-svg-y4Xz2W1EqKEjdPHA .branch-label { fill: lightgrey; color: lightgrey; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-y4Xz2W1EqKEjdPHA .pieTitleText { text-anchor: middle; font-size: 25px; fill: black; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-y4Xz2W1EqKEjdPHA .slice { font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-y4Xz2W1EqKEjdPHA g.stateGroup text { fill: #9370DB; stroke: none; font-size: 10px; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-y4Xz2W1EqKEjdPHA g.stateGroup text { fill: #9370DB; fill: #333; stroke: none; font-size: 10px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA g.statediagram-cluster .cluster-label text { fill: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA g.stateGroup .state-title { font-weight: bolder; fill: black; }

#mermaid-svg-y4Xz2W1EqKEjdPHA g.stateGroup rect { fill: #ECECFF; stroke: #9370DB; }

#mermaid-svg-y4Xz2W1EqKEjdPHA g.stateGroup line { stroke: #9370DB; stroke-width: 1; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .transition { stroke: #9370DB; stroke-width: 1; fill: none; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .stateGroup .composit { fill: white; border-bottom: 1px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .stateGroup .alt-composit { fill: #e0e0e0; border-bottom: 1px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .state-note { stroke: #aaaa33; fill: #fff5ad; }#mermaid-svg-y4Xz2W1EqKEjdPHA .state-note text { fill: black; stroke: none; font-size: 10px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .stateLabel .box { stroke: none; stroke-width: 0; fill: #ECECFF; opacity: 0.7; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .edgeLabel text { fill: #333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .stateLabel text { fill: black; font-size: 10px; font-weight: bold; font-family: 'trebuchet ms', verdana, arial; font-family: var(--mermaid-font-family); }

#mermaid-svg-y4Xz2W1EqKEjdPHA .node circle.state-start { fill: black; stroke: black; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .node circle.state-end { fill: black; stroke: white; stroke-width: 1.5; }

#mermaid-svg-y4Xz2W1EqKEjdPHA #statediagram-barbEnd { fill: #9370DB; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .statediagram-cluster rect { fill: #ECECFF; stroke: #9370DB; stroke-width: 1px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .statediagram-cluster rect.outer { rx: 5px; ry: 5px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .statediagram-state .divider { stroke: #9370DB; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .statediagram-state .title-state { rx: 5px; ry: 5px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .statediagram-cluster.statediagram-cluster .inner { fill: white; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .statediagram-cluster.statediagram-cluster-alt .inner { fill: #e0e0e0; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .statediagram-cluster .inner { rx: 0; ry: 0; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .statediagram-state rect.basic { rx: 5px; ry: 5px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .statediagram-state rect.divider { stroke-dasharray: 10,10; fill: #efefef; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .note-edge { stroke-dasharray: 5; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .statediagram-note rect { fill: #fff5ad; stroke: #aaaa33; stroke-width: 1px; rx: 0; ry: 0; }

:root { --mermaid-font-family: '"trebuchet ms", verdana, arial'; --mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .error-icon { fill: #552222; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .error-text { fill: #552222; stroke: #552222; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .edge-thickness-normal { stroke-width: 2px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .edge-thickness-thick { stroke-width: 3.5px; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .edge-pattern-solid { stroke-dasharray: 0; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .edge-pattern-dashed { stroke-dasharray: 3; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .edge-pattern-dotted { stroke-dasharray: 2; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .marker { fill: #333333; }

#mermaid-svg-y4Xz2W1EqKEjdPHA .marker.cross { stroke: #333333; }

:root { --mermaid-font-family: "trebuchet ms", verdana, arial;}

新建 活跃就绪 静止就绪 执行 活跃阻塞 静止阻塞 退出 允许进入 允许进入 挂起 激活 分派 时间片用完(超时) 事件等待(I/O请求) 挂起 事件发生(I/O完成) 挂起 激活 事件发生(I/O完成) 释放 新建 活跃就绪 静止就绪 执行 活跃阻塞 静止阻塞 退出

这里写图片描述

阻塞及挂起的理解

  1. 挂起是一种主动行为,是把一个进程从内存转到外存,而阻塞则是一种被动行为(并不绝对,看个人理解),是在等待事件或资源时任务的表现。对于挂起,其进程所有资源都转入外存;而阻塞,其进程所有资源依然保存在内存中
  2. 对应挂起的行为是激活,即当没有活动就绪进程时或静止就绪队列里面有进程优先级高于活动就绪里面所有进程,还有就是当一个进程释放足够内存时,系统会把一个高优先级阻塞激活。而阻塞却没有对应的主动行为来解除,需要其他进程或系统唤醒。
  3. 一个比喻:只有一个锅,当食材已经准备充分的菜就可以下锅,这就是执行态;而其他准备好的菜就顺序放在一旁,等待下锅,这就是就绪态;还有的菜准备还不是很充分,例如该切片的菜还没有切片,还有一些佐料还没有从冰箱里拿出,这就是I/O操作等待,类似阻塞态;而还有一种情况就是厨房的面积太小了,桌子上放不下那么多的准备下锅的菜,于是先将那些还没有准备好的菜放入冰箱,如果还是放不了那么多菜,就把那些已经准备好的但没有下锅的菜放入冰箱,以免变质,这就是挂起态;当桌子上有位置了,就把菜从冰箱拿出来,这便是激活操作。做好的菜就可以端出厨房,这便是退出态。(PS:这里我假设冰箱空间很大,也存在那种炒到一半的菜放到一边的情况,即从执行态到就绪态或阻塞态的情况,这种情况可以类似川菜中先将肉处理一下(去腥等等),然后又从锅里捞出来,用豆瓣和其他佐料来进行腌制(这里如果佐料没有在桌子上就类似进入阻塞态,而如果有就相当于进入就绪态,但是锅里已经被占用了,需要等待一会儿)至于优先级的高低,也可类比有些菜是为了其他菜做铺垫(举个例子:在川菜里面,回锅肉和炒白菜,一般家庭会优先做回锅肉,因为当做回锅肉时,会炒出许多猪油,而这些有可以用来炒白菜,这样的炒白菜不仅好吃,而且也节约了许多油。))
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/210037.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • 简单高效,分享几款我在使用的效率神器[通俗易懂]

    做一个积极的人编码、改bug、提升自己我有一个乐园,面向编程,春暖花开!今天周六了,分享几款我目前在用的小工具,希望对你有用。使用工具的好处等等,我就不过多介绍了,下面文章的内容是先简单介绍这几款工具,然后说明一下我是怎么应用的。简单的一个思维导图,看下本文全貌:文章目录神器介绍1、火柴-效率神器2、ALTRun – 快速启动3、Typora – Markdown 编辑器4、Snip…

  • linux防火墙(firewall、iptable)

    linux防火墙(firewall、iptable)一、iptables防火墙1、基本操作#查看防火墙状态serviceiptablesstatus#停止防火墙serviceiptablesstop#启动防火墙serviceiptablesstart#重启防火墙serviceiptablesrestart#永久关闭防火墙chkconfigiptablesoff…

  • lcd1602使用手册_lcd1602的rs,rw和e三个引脚的功能

    lcd1602使用手册_lcd1602的rs,rw和e三个引脚的功能1602液晶也叫1602字符型液晶,它是一种专门用来显示字母、数字、符号等的点阵型液晶模块。1602LCD是指显示的内容为16X2,即可以显示两行,每行16个字符液晶模块(显示字符和数字)。lcd1602引脚状态字的说明:RAM映射地址:控制接口的时序:1.读的时序2.写的时序3.时序的相关参数读状态:RS=L,R/W=H,EN=H读数据:RS=H,…

  • VMware 虚拟机里连不上网的五种解决方案「建议收藏」

    VMware 虚拟机里连不上网的五种解决方案「建议收藏」在VMware虚拟机里的虚拟机系统连接不上网络首先,注意查看适配器选项里的网络连接这两个网络连接是否存在,如果不存在可以重新装一下VM如果存在,连不上网解决办法一:虚拟机设置里,找到“网络适配器”,右边的网络连接选择“NAT模式”,如果不行的话再linux系统。还是不行的话接着看第二种解决方案。解决方法二:可能原因是VMwareNETService…

  • LARGE_INTEGER解析和使用

    LARGE_INTEGER解析和使用这里解释前面碰到的LARGE_INTEGER结构。与可能的误解不同,64位数据并非要在64位操作系统下才能使用。在VC中,64位数据的类型为__int64。定义写法如下:     __int64file_offset;     上面之所以定义的变量名为file_offset,是因为文件中的偏移量是一种常见的要使用64位数据的情况。同时,文件的大小也是如此(回忆上一

  • Struts2拦截器实现异常处理[通俗易懂]

    Struts2拦截器实现异常处理[通俗易懂]Struts2拦截器实现异常处理机制在j2ee项目中,系统内部难免会出现一些异常,如果把异常放任不管直接打印到浏览器可能会让用户感觉莫名其妙,也有可能让某些用户找到搞定系统的方法。所以不要在页面上输出错误信息,使用log日志的方式处理异常并记录异常。就拿struts2+hibernate+spring项目说明:通常一个页面请求到后台以后,首先是到action(也就是所谓mvc的c

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号