Title: By Juthawut Chantharamalee
1Operating System 2
- By Juthawut Chantharamalee
Suan Dusit Rajabhat University (Computer Science)
2????? 6 ???????????????????????????Â
(Process Management)
????? 2
Suan Dusit Rajabhat University (Computer Science)
36.1 ???????????????????????? (Process Concept)
- ????????????????????????????????
????????????????????????????? (Process)
??????????????????????????????????????????????
(Single Process) ?????????????????????????????
???????????????????? ?????????????????????????????
???????????????????????????????????????????????
??????????????????????????????????????????????????
?????????????????? ?????????????????????
(multi-user computer system) ?????????????????????
????????????????
Suan Dusit Rajabhat University (Computer Science)
46.1 ???????????????????????? (Process Concept)
- ?????????????????????????? ???????????????????????
?????????? ???????????????????????????????
?????????????????? ???????????????????????????????
???????????????????? ?????????????????????????????
??????????????????????????????????????????????????
??????????????????????????? (interaction)
?????????????????? ????????????????????????? ????
?????????????????????? (process
synchronization) ?????????????????????????????????
????????
4
Suan Dusit Rajabhat University (Computer Science)
56.1 ???????????????????????? (Process Concept)
- 6.1.1 ?????????????????? (The Process) ?????????
(Process) ????????????????????????????????????????
?????????????????????????????????????????
????????????????????????????(Text Section)
?????????????????????????????????? (Program
Counter) ?????????????????????????????????????????
?????????????????? (CPU) ?????????????????????????
????????????????????????????????????
????????????????????????????????
????????????????????????? ??????????????????
(Process) ??????????????????????????????????
5
Suan Dusit Rajabhat University (Computer Science)
66.1 ???????????????????????? (Process Concept)
- 6.1.2 ????????????????? (Process State)
???????????????????????????????????????????
(Process) ?????????????????????????????? (State)
?????????????????????? ?????? New
???????????? ????????????????????? (Created)
??????Running ???????????? ???????????????????????
????? (Executed) Waiting ???????????? Process
????? (Waiting) ??????????????????????????????
(??????????????? I/O ????????? signal ????????)
Ready ???????????? Process ?????????????????????
CPU Terminal ???????????? Process
????????????????????????
6
Suan Dusit Rajabhat University (Computer Science)
7 ?????? 6.1 ??????????????????????????????????????
(Diagram of Process State)
Suan Dusit Rajabhat University (Computer Science)
86.1 ???????????????????????? (Process Concept)
- 6.1.3 ???????????????????? (Process Control
Block) - PCB ???????????????????????????????????????????
??????????????????????????? (Process)
??????????????????? ??????????????????? (Task
Control Block) ???????????????? 6.2
????????????????
8
Suan Dusit Rajabhat University (Computer Science)
9?????? 6.2 ???????????????????? (Process Control
Block PCB)
9
Suan Dusit Rajabhat University (Computer Science)
106.1 ???????????????????????? (Process Concept)
- 6.1.3 ???????????????????? (Process Control
Block) - 1. ????????????????? (Process State)
????????????????????????????? (New) ??????????
(Running) ????????????????????? (Running)
???????? (Waiting) ???????????????????? (Halted)
??????? 2. ??????????
(Program Counter) ????????????????????????????????
?????????? (Process) ????????????????
10
Suan Dusit Rajabhat University (Computer Science)
116.1 ???????????????????????? (Process Concept)
- 6.1.3 ???????????????????? (Process Control
Block) - 3. ???????????????????????????????????????
(CPU Registers) ??????????????????????????????????
???????????????????????????????????????
????????????????????????? ??????????
(Accumulator) ???????????????? (Index Register)
????? (Stack) ?????? (Pointer) ???
???????????????? (General-Purpose Registers)
?????????????????????????????????????
(Condition-Code Information) ???????
??????????????????????????????????????????
(Process) ??????????????????????????? (Interrupt)
????????????????????????????????????? ??????????
6.3
11
Suan Dusit Rajabhat University (Computer Science)
12?????? 6.3 ???????????????????????????????????????
???????????????? (Diagram Showing CPU Switch from
Process to Process)
12
Suan Dusit Rajabhat University (Computer Science)
136.1 ???????????????????????? (Process Concept)
- 6.1.3 ???????????????????? (Process Control
Block) - 4. ???????????????????????????????????
(CPU-Scheduling Information) ?????????????????????
????????????????????????????????? Process
Priority ??????????? Queues ???????Parameters
????? ????????????????????????????????????????????
? 5. ???????????????????????????????(Memory-
Management Information) ??????????????????????????
?????????? Base Register ?????????? Limit
Register ???? Page Tables ???? Segment Tables
??????????????? Memory System ??? Operating
System ???????????
13
Suan Dusit Rajabhat University (Computer Science)
146.1 ???????????????????????? (Process Concept)
- 6.1.3 ???????????????????? (Process Control
Block) - 6. ??????????? (Account Information)
??????????????????????????????????????????????
(Amount CPU) ????????????????? ? ???????????
(Limit Times) ??????????? (Account Numbers) ???
(Job) ?????????????????????????? (Process
Numbers) 7. ????????????????????????
?????? (I/O Status Information)
???????????????????????????????????????????
(Allocated) ???????????????????????????? (I/O
Devices) ???????????????????????? (Open Files)
????????????????? (Process)
14
Suan Dusit Rajabhat University (Computer Science)
156.2 ??????????????????????? (Process Scheduling)
- ??????????????????????????????????????????????????
(Process) ???????????????????????????????????????
????????????????????????????????? (CPU
Utilization) ?????????????????????????????????????
????????????????????????????? (Process)
????????????????????????????????????
?????????????????????????????????? (Process)
??????????????????????????????????????????????????
?? (CPU) ?????????????????????????????????????????
???????????????? (Process) ????? ???????????????
?????????????????????????????????????? (Process)
??????????????????????????????????????????????
15
Suan Dusit Rajabhat University (Computer Science)
166.2 ??????????????????????? (Process Scheduling)
- 6.2.1 ??????????????????? (Scheduling Queues)
?????????????? (Process) ?????????????
?????????????????????????????? (Job Queue)
??????????????? (Process) ????????????????????????
????? (Main Memory) ??????????????????? (Ready)
??????????? (Wait) ???????????????????????????????
???????????? (List) ????????????????
????????????????????? (Ready Queue)
?????????????????????????????? (Ready Queue
Header) ??????????? (Lists) ?????????? (Pointers)
??????????????????????????????????????????????????
????? (Process Control Block PCB)
16
Suan Dusit Rajabhat University (Computer Science)
176.2 ??????????????????????? (Process Scheduling)
- ????????????????????????????????????????????
(PCB) ???????????????????? (Pointer Field)
????????????????????????????????? (PCB)
??????????? ???????????????????????????????????
????????? ????????????????????????????????????????
???????????????? I/O ???????????????
??????????????????????????????????????????????????
?????? (List) ???????????????????????????????
I/O ???????? ???????????????????????? (Device
Queue) ????????????????? (Process)
?????????????????????????????????????? (Process)
????????????? 6.4
17
Suan Dusit Rajabhat University (Computer Science)
18?????? 6.4 ???????????????????????????????????????
???????????????? (The Ready Queue and Various
I/O Device Queues)
18
Suan Dusit Rajabhat University (Computer Science)
196.2 ??????????????????????? (Process Scheduling)
- ??????????????????????????????????????????????????
?????????????????????????????? (Queuing Diagram)
????????????? 6.5 ????????????????????????????????
?????? (Queue) ???????????????????????????????????
??????????????????? ??????????????????????????????
???????? (Ready Queue) ???????????????????????????
?????????? (Device Queue) ????????????????????????
??????????????????????? ??????????????????????????
? (New Process) ???????????????????????????????
(Ready Queue) ????????????????????????????????????
?????????? (???????????? Dispatcher)??????????????
????? (CPU)
19
Suan Dusit Rajabhat University (Computer Science)
206.2 ??????????????????????? (Process Scheduling)
- ??????????????????????????????????????????????????
?????????????????????????????? - 1. ????????? (Process) ??????????????????????
I/O ???????????????????????????? 2.
????????? (Process) ??????????????????????????????
??????????????????????????? 3.
????????? (Process) ??????????????????????????????
????????? (CPU) ???????????????????????
(Interrupt) ??????????????????????????????????????
?? (Ready Queue)
20
Suan Dusit Rajabhat University (Computer Science)
21?????? 6.5 ???????????????????????????????????????
????????????(Queuing-Diagram Representation of
Process Scheduling)
21
Suan Dusit Rajabhat University (Computer Science)
226.2 ??????????????????????? (Process Scheduling)
- 6.2.2 ??????????????????? (Scheduler)
?????????????????????? (Process)
????????????????????????????????????? (Scheduling
Queues) ????????????????????????????????
??????????????????????????????????????????????????
???????? (Spooled) ? ?????????????????????????????
????????????? (Mass-Storage Device) ???? ?????
(Disk) ??????? ???????????????????????????????????
??????????????????????????????????? ??????
22
Suan Dusit Rajabhat University (Computer Science)
236.2 ??????????????????????? (Process Scheduling)
- 1. ?????????????????????????? ( Long-term
scheduler) ??????????????????? ??????????????(Job
Scheduler) ????????????????????????????????????
(Processes) ????????????????????? (Spool)
????????????? (Load) ?????????????????????????????
?????????????? ???????????????????????????????????
?????????????????????????????????????????? ??????
??????????????????????????????????????????????????
??????????????????? ??????????????? (Degree of
Multiprogramming) ??????????????????
23
Suan Dusit Rajabhat University (Computer Science)
246.2 ??????????????????????? (Process Scheduling)
- 2. ??????????????????????????? (Medium-term
scheduler) ???????????????????????????????????????
??????????? ???? ????????????????????????????
(Time-Sharing Systems)????????????? (Process)
???????????????????????????????????????? (Swapped
in) ?????????? (Swapped Out) ???????
???????????????? 6.6 3.
??????????????????????????? (Short-term
scheduler) ??????????????????? ???????????????????
??????? (CPU Scheduler) ??????????????????????????
?????????? (Processes) ???????????????????
(Ready) ????????????????? (Execute)
?????????????????????????? ????????????????
(CPU) ?????????????????????????????
24
Suan Dusit Rajabhat University (Computer Science)
25?????? 6.6 ???????????????????????????????????????
?????????? (Addition of Medium-Term
Scheduling to The Queuing Diagram)
25
Suan Dusit Rajabhat University (Computer Science)
266.2 ??????????????????????? (Process Scheduling)
- 6.2.3 ????????????????????? (Context
Switch)??????? (Switching) ????????????
(Process) ???????????????????????????????? (CPU)
???????????????????????????????????? (Old
Process) ?????????????????????????????????????????
???????????????????? (New Process)
?????????????????????????? ????????
????????????????????? (Context Switch)
???????????????????????? ?????????????????????????
?????? (PCB) ?????????????????????????????????????
?????????? (CPU Register) ????????????????????
(Process State) ???????????????? 6.1
26
Suan Dusit Rajabhat University (Computer Science)
276.3 ????????????????????????(Operations on
Processes)
- ????????? (Process) ????? ????????????????????????
????????????????????????????? ???????????????????
(Created) ????? (Deleted) ????????????????????????
?????????????????? ???????????????????????????????
??????????????????????????????????? (Process
Creation) ???????????????????????????????????
(Process Termination) ????????????????????????????
????????? ????????????????????????????????????????
???????????
27
Suan Dusit Rajabhat University (Computer Science)
286.3 ????????????????????????(Operations on
Processes)
- 6.3.1 ????????????????? (Process Creation)
????????? (Process) ??????????????????????????????
?????????? (System Call) ????????????????????????
???????????????????? ??????????????????? (Parent
Process) ?????????????????????????????????????????
? ???????????? (Children Process)
??????????????????????????????????????????????????
??????????????????????? ????????????? 6.7
????????????? ???????????????????????
?????? ???? ??????????????????????????? (CPU
Time) ??????????? (Memory) ???? (File)
??????????????????? (I/O Device) ???????
28
Suan Dusit Rajabhat University (Computer Science)
296.3 ????????????????????????(Operations on
Processes)
- ?????????????????????????????????????
?????????????????????????????????????????
????????????? (Subprocess) ???????????????????????
??????????????????????????????????????????????????
????????????????????????? (Parent)
???????????????????????????????? (Process)
??????????????????????????????????????????????????
?????????? ???????????????????????????????????????
????????????????????????
29
Suan Dusit Rajabhat University (Computer Science)
30?????? 6.6 ???????????????????????????????????????
?????????? (Addition of Medium-Term
Scheduling to The Queuing Diagram)
30
Suan Dusit Rajabhat University (Computer Science)
316.3 ????????????????????????(Operations on
Processes)
- 6.3.2 ??????????????????? (Process Termination)
?????????????????????????????????????????????
??????????????????????????????????????????????????
????????????????????????????????????????? (System
Call) ? ??????????????? (Process)
?????????????????????????????????????????
(Parent) ????? ???????????????????????????????????
?????????????????????????????????????????????????
??????????????????? (Parent) ????????????????????
???????????????????? (Children) ?????????????
??????
31
Suan Dusit Rajabhat University (Computer Science)
326.3 ????????????????????????(Operations on
Processes)
- 1. ???????????? (Children) ???????????????????????
??????????????? ??????????????????????????
(Parent) ?????????????????????????????????????????
????? (Children) ???? 2.
??????????????????????????????? (Children)
??????????????? 3. ???????????????????
(Parent) ?????????????????????????????????????????
???????????????? (Children) ??????????????????????
???????????????????? (Parent) ???????????????????
??????????????? (Children) ???????????????????????
????? ??????????????????????????????
?????????????????????? (Cascading Termination)
???????????? ??????????????
32
Suan Dusit Rajabhat University (Computer Science)
336.4 ?????????????????????? (Cooperating Process)
- ???????????????????? (Process) ???????????????????
????? ??????????????????????????????????
(Independent) ????????????????????????????????????
???????????????????? (Effect) ????????????????????
?????????????????????????? (Cooperating)
?????????????????????????????????????????????
(Effect) ???????????????????? ????????????????????
??????????????? ??????????????????????????????????
??????????????????????????????????????????????????
???????
33
Suan Dusit Rajabhat University (Computer Science)
346.4 ?????????????????????? (Cooperating Process)
- 1. ??????????????????? (Information Sharing)
2. ?????????????????????????? (Computation
Speedup) ???????????????????????????????????????
???????????????????????? Subtask ????????Subtask
?????????????????? Parallel ??????????????????????
?????????????????????????????????? ???? CPUs ,
I/O Channels ??????? 3.
???????????????? (Modularity) ????????????????????
(Process) ?????????????????
4. ????????????? (Convenience)
????????????????????????????????????
?????????????? ???? Editing, Printing, Compiling
in Parallel) ???????
34
Suan Dusit Rajabhat University (Computer Science)
356.5 ????????????????????????????????
(Interprocess Communication)
- ??????????????????????????????????????????????????
????? ????????????????????? (Multiprogramming)
????????????????????????????????????????????????
??????????????????????????????????????????????
(Process) ?????????? ?????????????????????????????
??????????????????????????????????????????????????
???? (Interprocess Communication IPC)
??????????????????????????????????????????????????
???? (Processes) ?????????????????????????????????
???????????? (Synchronize) ??????????????????????
?????????????????????? ???????????????????????????
????????? ??????????????????????
35
Suan Dusit Rajabhat University (Computer Science)
366.5 ????????????????????????????????
(Interprocess Communication)
- 6.5.1 ????????????????? (Message-Passing System)
??????????????????????????? ???????? Processes
????????????????Processes ????????????????????????
?????????????????????????? ???????????????????????
??????????????????????????????? Microkernel's
???????? ????????????????????????????? Processes
???????? ???????????????????????????kernel
???????????????????????Processes
???????????????????????????????????????????????
??????????????????????????????????? (IPC)
????????????????? 2 ??? ??? send(message)???
receive(message) ????? Communication Link
?????????????????????? 2 Processes
36
Suan Dusit Rajabhat University (Computer Science)
376.5 ????????????????????????????????
(Interprocess Communication)
- ??????????????????????????????????????????????????
??????????????????????????????? ???????
(Send/Receive Operations) ??????????? 1.
??????????????????????????? (Direct or Indirect
Communication) - 2. ???????????????????????????????? (Symmetric
or Asymmetric Communication) - 3. ??????????????????????????????????
(Automatic or Explicit Buffering) - 4. ????????????????????????????????????? (Send
by Copy or Send by Reference) - 5. ????????????????????????????????????????????
(Fixed-Sized or Variable-Sized Massage)
37
Suan Dusit Rajabhat University (Computer Science)
386.5 ????????????????????????????????
(Interprocess Communication)
- 6.5.2 ?????????????????????? (Naming)
????????? (Process) ??????????????????????
?????????????????????????????????????????? ????
??????????????????? (Direct Communication)
???????????????????? (Indirect Communication)
??????? - 6.5.2.1 ???????????????? (Direct
Communication) ???????????????????????????????????
??????? (Process) ????????????????????????????????
??????????????????????????????????????????????????
??????????????
38
Suan Dusit Rajabhat University (Computer Science)
396.5 ????????????????????????????????
(Interprocess Communication)
- ??????????????????????? (Symmetry)
- send(P, message) ??????? ??????????????????????
Process P receive(Q, message)
??????? ???????????????????? Process Q
????????????????????????????????????????????????
????????????? - ????????????????????????
??????????????????????????? (Process) ??????
(???????????????) ?????????????????????????????
?? (Process) ?????????????????????????????????????
????????????????????????? -
????????????????????????????????????????????????
(Process) - ???????????????? (Process)
?????? (???????????????) ?????????????????????????
??????????????????????????
39
Suan Dusit Rajabhat University (Computer Science)
406.5 ????????????????????????????????
(Interprocess Communication)
- ?????????????????????????? (Asymmetry)
send(P, message) ???????
?????????????????????? Process
Receive(id,
message) ??????? ???????????????????? Process
??? ????????????? id ????????????????????
Process?????????????
40
Suan Dusit Rajabhat University (Computer Science)
416.5 ????????????????????????????????
(Interprocess Communication)
- 6.5.2.2 ????????????????? (Indirect
Communication) ???????????????????????????????????
? (Process) ??????????????????????????????????????
????????????????? ???????????? (Mail Box) ????
????????????????? (Port) ?????????????????????????
????????????????????? (Process)
????????????????????????? (Process)
??????????????????????????????????????????????????
????????? (Unique) ???????????????????????????????
?????????????????? (Process) ?????????????????????
?????????????????????? ???????????????? (Process)
????????????????????????????????????
??????????????????????????????????????
41
Suan Dusit Rajabhat University (Computer Science)
426.5 ????????????????????????????????
(Interprocess Communication)
- send(A, message) ??????? ??????????????????????
Mail Box A receive(A, message) ???????
???????????????????? Mail Box A
??????????????????????????????????????????????????
??????????? - ????????????????????????????
??????????????????????? (Process) ??????
(???????????????) ????????????????????????????????
??????? (Mail Box) ???????????????
??????????????????????????????????????????????????
????????? 2 Process - ???????????????????????????
? (Process) ???????????????????
??????????????????????????????????????????????????
??? (Mail Box) ?????????????
42
Suan Dusit Rajabhat University (Computer Science)
436.5 ????????????????????????????????
(Interprocess Communication)
- 6.5.3 ??????????????????????????????????????
(Synchronization or Asynchronization)
????????????????????????????????????????
(Blocking) ???????????????????????????????????????
??????????????????????????????????????
(Nonblocking) ????????????????????? (Send)
???????????????? (Receive) ?????? - 1.????????????????????????????????????????????????
??????? (Blocking Sent) ???????????????????????
(Process) ???????????????????? ???????????????????
????????????????????????????????????
(Acknowledgement) ????????????????????????????????
??????????????????????????????
43
Suan Dusit Rajabhat University (Computer Science)
446.5 ????????????????????????????????
(Interprocess Communication)
- 2.????????????????????????????????????????????????
?????????? (Nonblocking Sent) ???????????
???????????? (Process) ????????????????????
??????????????????????????????????????????????????
???????(Acknowledgement) ?????????????????????????
?????????????????????????????????????
????????????????????????????????? (Buffer)
???????????????????????????????????????????? - 3.????????????????????????????????????????????????
??????? (Blocking Receive) ???????????????????????
(Process) ????????????????????
??????????????????????????????????????????????????
??? ??????????????????????????????????????????????
???????????????????????????????????????????
44
Suan Dusit Rajabhat University (Computer Science)
456.5 ????????????????????????????????
(Interprocess Communication)
- 4.????????????????????????????????????????????????
?????????? (Nonblocking Receive)
??????????????????????? (Process)
???????????????????? ????????????????????????
?????????????????????????????????????? ??????
????????????????????????????
45
Suan Dusit Rajabhat University (Computer Science)
466.5 ????????????????????????????????
(Interprocess Communication)
- 6.5.4 ???????????? (Buffering) ???????????????????
????????????????????? (Direct) ???????????
(Indirect) ????????????????????
????????????????????? (Process)
???????????????????????????? ?????????????????????
?????????????? 3 ????????????? - 1. ??????????????? (Zero Capacity)
??????????????????????????????????? 0
??????????????????????????????????????????????????
??? ????????? ????????????????????????????????????
??????????????????????? 2.
????????????? (Bounded Capacity)
???????????????????????????????????? n
46
Suan Dusit Rajabhat University (Computer Science)
476.5 ????????????????????????????????
(Interprocess Communication)
- ?????????????????????????? n ?????????????????
(Resize) ????????????? ???????????????????????????
??????????????????????????????????????????
(?????????????????????????????????????????????????
??????????????) ??????????????????????????????????
?????????????????????????????????????????????????
???????????????????????????????
??????????????????????????????????????????????????
???????????????????????????????????
47
Suan Dusit Rajabhat University (Computer Science)
486.5 ????????????????????????????????
(Interprocess Communication)
- ?????????????????????????? n ?????????????????
(Resize) ????????????? ???????????????????????????
??????????????????????????????????????????
(?????????????????????????????????????????????????
??????????????) ??????????????????????????????????
?????????????????????????????????????????????????
???????????????????????????????
??????????????????????????????????????????????????
??????????????????????????????????? - 3. ???????????????? (Unbounded Capacity)
??????????????????????? ???????????
?????????????????????????????????????
?????????????????????????????????????? -
48
Suan Dusit Rajabhat University (Computer Science)
49 ????
- ????????????????????????????????????????
??????????????????????????????????????????????????
?????????????? ???????????????????????????????????
????????????????????? ??????????????????????????
????????? (Process) ??????????????????????????????
??????????????? ??????????????????????????????????
????????? - Process ???????????????????????????????????????
??????????????????????????????????????????
????????????????????? Text Section
?????????????????????Program Counter
??????????????????????????????????????????????????
????????? (CPU) ??????????????????????????????????
??????????????????????????? ??????????????????????
?????????? ?????????????????????????
?????????????????? (Process) ?????????????????????
?????????????
Suan Dusit Rajabhat University (Computer Science)
50 ????
- ????????????????? (Process State)
???????????????????????????????????????????
(Process) ?????????????????????????????? (State)
?????????????????????? ?????? New ????????????
????????????????????? (Created) ?????? Running
???????????? ????????????????????????????
(Executed) Waiting ???????????? ?????????
(Process) ???????? (Waiting) ?????????????????????
????????? (??????????????? I/O ???????????????
(signal) ????????) Ready ???????????? ?????????
(Process) ??????????????????????????????????????
(CPU) Terminal ???????????? ????????? (Process)
????????????????????????
Suan Dusit Rajabhat University (Computer Science)
51 ????
- ??????????????????????????????????????????????????
???????? (Process) ???????????????????????????????
????????????????????????????????????????? (CPU
Utilization) ?????????????????????????????????????
????????????????????????????? (Process)
????????????????????????????????????
?????????????????????????????????? (Process)
??????????????????????????????????????????????????
?? (CPU) ?????????????????????????????????????????
???????????????? (Process) ????? ???????????????
Suan Dusit Rajabhat University (Computer Science)
52 ????
- ????????? (Process) ????? ????????????????????????
????????????????????????????? ???????????????????
(Created) ????? (Deleted) ????????????????????????
?????????????????? ???????????????????????????????
????????????????????? Process Creation
??????????????????????????????????? (Process
Termination) ?????????????????????????????????????
- ???????????????????????????????????????????????
???????? ????????????????????? (Multiprogramming)
????????????????????????????????????????????????
?????????????????????????????????????Process
?????????? ???????????????????????????????????????
???????????? ????????????????????????????????
(Interprocess Communication IPC)
Suan Dusit Rajabhat University (Computer Science)
53The EndLesson 6
Suan Dusit Rajabhat University (Computer Science)