State
diagram presents the order of states underwent by an object within the system.
State is defined using ‘state’ keyword.
state New
You can add colors to the state using #color notation.
state Running #green
You can give an alias to the state using ‘as’ keyword.
state "Suspend ready" as SR #FFFF77
You can connect one state to other state using -->
Ready --> Running : Schedule/dispatch
‘Schedule/dispatch’ message is displayed as array label.
helloworld.txt
@startuml
<style>
document {
BackGroundColor silver
}
</style>
left to right direction
skinparam roundCorner 50
title "Operating System Process states"
state New #magenta
state Ready #palegreen
state Running #green
state "Suspend wait" as SW #FFBA77
state "Wait / block" as WB #FFDF77
state "Suspend ready" as SR #FFFF77
state Termination #red
[*] --> New
New --> Ready
Ready --> Running : Schedule/dispatch
Running --> Ready : Priority/time elapse
Running --> Termination : completion
Running --> WB : I/O Request
WB --> Ready : I/O completion
WB --> SW : Suspend
SW --> WB : Resume
SW --> SR : Completed I/O, but still in suspend
SR --> Ready : Resume
Ready --> SR : Suspend
Termination --> [*]
@enduml
Above snippet generate below diagram.
Points to note
a. [*] is used as starting and ending point in the state diagram.
b. --> Connect two states
Previous Next Home

No comments:
Post a Comment