์ปค๋์ ์ง์ ํ์
โจ IPC์ ๋ชฉ์ = ํ๋ก์ธ์ค ๋๊ธฐํ
- data transfer
- sharing data
- event notification
- resource sharing and synchronization
- process control
Message Passing
- ์ปค๋์ ํตํด ์ฃผ๊ณ ๋ฐ์
- user ๊ณ์ธต์ ์๋ ํ๋ก์ธ์ค๋ค๋ผ๋ฆฌ ์ง์ ํต์ X
๐ OS์์ ์ ๊ณตํ๋ message passing์ ๊ดํ system call์ ์ด์ฉํด ์ปค๋์ ๊ฑฐ์ณ๊ฐ
- user ๊ณ์ธต์ ์๋ ํ๋ก์ธ์ค๋ค๋ผ๋ฆฌ ์ง์ ํต์ X
- Messsage queue
- Pipes
- Mailboxes
- Sockets
communication link๋ฅผ ๋ง๋ค์ด์ ๋ฉ์์ง๋ฅผ ์ฃผ๊ณ ๋ฐ์
๐น Direct Communication
- ํ๋ก์ธ์ค๋ฅผ ์ง์ ์ง๋ช
- send(P, message)
receive(Q, message)
- send(P, message)
- ์๋๋ฐฉ์ ID๋ฅผ ํ์คํ๊ฒ ์์์ผํจ (๋จ์ )
๐น Indirect Communication
- ํ๋ก์ธ์ค ์ง์ X
- ์ง์ ์ ๋ฌํ์ง ์๊ณ , ํ๋ก์ธ์ค ๊ฐ ์ฃผ๊ณ ๋ฐ์ ์ ์๋ mailbox ์กด์ฌ
- mailbox๋ ๊ณ ์ ์ id๋ฅผ ๊ฐ์ง. mailbox=A
- send(A, message)
- receivce(A, message)
๐น Synchronization in Message Passing
- Blocking is considered synchronous
- Blocking send : sender blocked until message received by mailbox or process
- Blocking receive : receiver blocks until a message is available
- Symmetric communication (blocking send and receive)
- sending process stops until the receive process completes
- Non-blocking is considered asynchronous
- Nonblocking send : send resumes operation immediately after sending
- Nonblocking receive : receiver returns immediately with either a vaild or null message
- Asymmetric communication
- Sending process continues executing without waiting for a response from the receive procses
๐ ์๋์ ์ผ๋ก Synchronous๊ฐ ๋๋ฒ๊น ํ๊ธฐ ์์ํ์ง๋ง, blocking ๋๋ฌธ์ deadlocks ๋ฐ์ โก๏ธ Timeout ์ฌ์ฉํด์ ํด๊ฒฐ
๐น Message Queue
- ์๊ฐ ์ฐจ์ด๊ฐ ๋๋๋ผ๋ ๋ฉ์์ง๋ฅผ ์ ๋ฌ๋ฐ์ ์ ์์
๐น Pipes
- FIFO buffers
- file I/O interface
- asynchronous send() & receive()
- read-write pipe
Shared Memory
- IPC ์ค ๊ฐ์ฅ ๋น ๋ฆ
- ์ปค๋ ์ชฝ์ copyํ ํ์ ์๊ธฐ ๋๋ฌธ
- ํ๋ก์ธ์ค A์ B๊ฐ ํจ๊ป ๊ณต์ ํ ์ ์๋ ๋ฉ๋ชจ๋ฆฌ ์กด์ฌ
- OS๊ฐ memory segment์ mapping
Sockets
- ๋ ๊ฐ ํ๋ก์ธ์ค ๊ฐ์ ์๋ฐฉํฅ ํต์ (Server, Client)
- Internet domain communication ๐ TCP/IP internet protocol suite
- Server
- socket()
- bind() : ์์ผ๊ณผ internet address ์ฐ๊ฒฐ
- listen() : ๋ฐ์ดํฐ ๋ฐ์ ์ค๋น
- accept() : fork() a child process
- Client
- socket()
- connect()
- call read() and/or write()
'CS > โ๏ธ ์ด์์ฒด์ ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[โ๏ธ OS] ํ๋ก์ธ์ค ๋๊ธฐํ (0) | 2024.03.09 |
---|---|
[โ๏ธ OS] CPU ์ค์ผ์ค๋ง (1) | 2024.03.03 |
[โ๏ธ OS] Thread (0) | 2024.02.29 |
[โ๏ธ OS] Process (1) | 2024.02.27 |