Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
บทที่ 4 กระบวนการ
1. 4
(PROCESS)
concurrent)
4.1 Process Concept)
job
user program) task MS-DOS Macintosh
interactive) batch)
jobs process
4.1.1 (The Process)
process)
program counter ( register CPU) ,stack ( , data section
( global)
passive entity)
active entity) program counter
2
13. Buffer)
Unbounded-buffer)
Bounded-buffer)
share memory)
share
var n;
type item = … ;
var buffer: array [0..n-1] of item;
in,out: 0..n-1;
- in out 0 in , out 0 n – 1
- Circular array)
- in
- out
in = out in + 1) MOD n = out
repeat
…
produce an item in nextp
…
while (in + 1) mod n = out do no-op; //
buffer[in] := nextp;
in := (in + 1) mod n; //
until false;
nextp local variable)
14. no-op (No-operation)
nextc
repeat
while in = out do no-op;
nextc := buffer[out];
out := (out + 1) mod n; //
…
consume the item in nextc
…
until false;
n – 1
4.6 Interprocess Communication IPC)
IPC
synchronize) message system)
4.6.1 (Basic Structure)
share variable) IPC
2
- send (message)
- receive (message)
p q
communication link
Link
- physical share memory) , hardware bus
network)
- logical logical properties)
implement) link
- link
15. - link 2
- link
- link link
- link
variable-size) fixed-sized)
- Link unidirectional) bidirectional)
unidirectional link
link logical
-
- symmetric asymmetric
- explicit)
- copy) reference)
- fixed-sized) variable-sized)
4.6.2 (Naming)
4.6.2.1 (Direct Communication)
send (P ,message) P (send to P)
receive (Q, message) Q (receive from Q)
Link
- Link
- Link 1 Link 2
- Link 2
producer-consumer)
repeat
…
16. produce an item in nextp
…
send (consumer, nextp);
until false;
repeat
receive (producer , nextc);
…
consume the item in nextc
…
until false;
4.6.2.2 (Indirect Communication)
mailboxes) ( port)
unique identification)
2
share mailbox)
Link
- Link
- Link associated)
- link link
1
- Link
P1 , P2 P3 A P1
A P2 P3 A
P1
- link 2
- P2 P3
-
17. -
-
P A
Q P Q A
4.6.3 (Buffering)
link
Queue) 3
- Zero capacity) 0
link
synchronization) rendezvous
- Bounded capacity) n
n queue)
- Unbounded capacity)
send operation)
P Q
P
send (Q, message);
receive (Q, message);
Q
receive (P, message);
send (P, “acknowledgment”);
P,Q) asynchronous
18. -
-
Remote Procedure Call –
RPC)
4.6.4 (Exception Condition)
4.6.4.1 (Process Terminates)
terminate)
2
1. P Q
P block
P P Q
2. P Q
automatic-buffering scheme)
P P
Q P Q acknowledgment)
P block 1
P P Q
4.6.4.2 (Lost Messages)
P Q
3
1.
2.
3.
19. timeout
4.6.4.3 (Scrambled Messages)
Checksum),
parity), CRC
4.6.5 Windows NT
NT multiple) subsystem)
client server NT
NT Local
Procedure Call Facility (LPC)) LPC NT 2
client
2 port) NT
connection port) communication port)
communication channel)
- client
- client
- server 2 client 1
- client server
reply)
NT 3
1. queue) port)
256
2. client section object (share memory)