13. 14. Interprocess Communication Flashcards

Synchronisation and Blocking Primitives Socket Level Client Server Systems

1
Q

In the most basic form of IPC, each process acts as….

A

Sender or receiver or both

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the most important facility that the OS provides for IPC? What does it rely on the OS for?

A

An Application Programming Interface (API) for IPC.

Two important services it relies on the OS for are:
Providing synchronisation Mechanisms
Keeping network buffers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What API operations do processes call to communicate?

A

Connect- sender process calls this to initiate the engagement
Accept- receiver process calls to specifier its readiness
Disconnect- either process use this to disengage
Send- sender process calls this passing as arguments the receiver and the data
Receive- Receiver process calls this passing as arguments the location where data is to be placed (and maybe the sender)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What signals does the OS Kernel respond to calls with?

A
S_C- Asynchronous send complete
R_C- asynchronous receive complete
wa- wait for asynchronous send
ws- wait for synchronous send
wr- wait for receive
(p,s_c)- wait, synchronous send complete
(p,r_c)- wait, synchronous receive complete
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What happens when a process wants to communicate with another process?

A

Call API operations in a predetermined order.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What happens upon an operation call?

A

An interaction event occurs
Send- causes the event where the data is transmitted to the other process
receive- causes the event where upon the receipt of data the received data is placed in the specified location

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What types of send operations are there?

A

Blocking Send- sender is blocked until message is received.
Non-blocking Send- messages are queued in an unbounded message buffer, sender never blocked.
Buffer-blocking Send- messages are queued in a bounded message buffer and sender is only blocked if buffer is full.

Blocking signals come from the OS kernel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the types are receive operations?

A

Blocking receive- receiver is blocked until a message is available
Non-blocking receive- the receiver is never blocked

Blocking signals come from the OS kernel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Synchronous message passing?

A

The send and receive operations are both blocking.

Whichever executes its operation first will be blocked

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is asynchronous message passing?

A

blocking receiver operations are user either with non-blocking or buffer-blocking send

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Basic API for IPC- what signals does the OS kernel respond to calls with

A

Asynronous send complete s_c- respond to sender with this when the request to send has been completed. (data en route)

Asynchronous receive complete r_c- responds to the receiver process with this then the request to receive has been carried out (data available)

Synchronous versions of these signals (p,s_c) and (p-r_c) are paired up with others such as wa, ws, wr

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the three timelines for each communicating process?

A

a) application process’ thread of control
b) the copying to/from buffers in OS user or kernel space
c) for the OS kernel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the two basic ways for a DS to share information?

A

Share State

Exchange Messages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How was the second lab a shared-state system?

A

The PHP server acted as a blackboard. One of the clients polled to see if there was anything new written

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How was the third lab a message-passing system?

A

We wrote both client and server. Clients send messages to server, server sends them to the clients

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a protocol? for IPC?

A

set of rules

Stipulates the precise sequence of events that must be enacted by the communicating processes

17
Q

What types of communication events are there?

A

Uni-cast (one process to one process)

Multi-cast (one process to many others)

18
Q

How can protocols be build using the services provided by the OS? What are the recent trends?

A

A protocol stack can be built over the basic services.

The Socket API is a high level API over which developers can build bespoke protocols i.e. for Distributed algorithms

Recent trend- use the application layer as a transport layer.
Also- use the application layer through a socket abstraction

19
Q

Describe a Socket

How are they referenced?

A

A programming abstraction to implement low-level IPC.

Two processes exchange information by each having a socket as an endpoint

Sockets are referenced by a descriptor, i.e. they can be viewed as I/O streams.

Once a socket is created, it is prepared by a series of calls to socket API. You then write and read from the socket

20
Q

What is a client side socket?

A

the endpoint of a conversation. Short lived e.g. web browser sockets are created to send then receive then are discarded.
Example: Gopher

21
Q

What are the steps of setting up a server socket?

A

1) create the socket for a given transport (TCP) and internet protocol (IPv4)
2) set the server socket options i.e. if reusable
3) Bind the server socket to a host address and a port
4) start listening to connections on the server socket and set the max number that could be left waiting

22
Q

Give the steps of the connection handling loop

A

1) server socket blocks waiting to accept connections
2) when a connection is accepted we get the new client connected socket and the host and port of the client
3) the server process then handles the connection
4) The server process continues the loop
5) the client connected socket must be ordered to shut down and close when the handler is done