IPC Flashcards

All info taken from different sources... https://www.cs.unc.edu/~dewan/242/s07/notes/ipc/node3.html

1
Q

What is IPC?

A

Inter-process communication (IPC) is a set of methods for data interchange among potential multiple threads in one or more processes

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

Other names for IPC

A

inter-thread communication, inter-application communication

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

2 types of processes.

A

Independent process.
Co-operating process.

An independent process is not affected by the execution of other processes while a co-operating process can be affected by other executing processes.

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

What ways can processes communicate with each other?

A
  • Shared Memory

- Message passing

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

1) Shared memory communication, how does this work?

A

By writing and reading shared variables

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

1) How does one process know when the other process wrote new info?

A

In some cases it wouldn’t know. - This would be in a load balancing program that just looks at the current load of the other process in the storage

When it does know - use polling (puts undue burden on the cpu)

Or it gets a software interrupt

Or semaphores or conditions could be used

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

1) When using Semaphores what happens?

A

Process q could block till p changes s and sends signal that unblocks q

But these solutions don’t allow q to block automatically if s cannot contain all data.
- Here you need to use semaphores as an external protocol to implement a buffer

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

1) What is the most efficient way to implement shared memory applications? (what function - in the Linux and Solaris 2.x OS)

A

mmap() function

or shmget() - another way to let multiple processes attach a segment of physical memory to their virtual address spaces

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

1) mmap() function

A

The mmap() function shall establish a mapping between a process’ address space and a file, shared memory object, or typed memory object.

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

1) shmget() function

A

returns the identifier of the System V shared memory segment associated with the value of the argument key. It may be used either to obtain the identifier of a previously created shared memory segment (when shmflg is zero and key does not have the value IPC_PRIVATE), or to create a new set.

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

Is conventional shared memory distributed or centralized? and why?

A

It is centralized, found on one machine. This is because (even though distributed shared memory over LANs has been worked on) even if we implemented distributed shared memory (without message passing it is not ideal)

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

Is shared memory used with client-server interaction?

A

No, not the best abstraction for clients sending server requests (requires coding as data structures unless structures encapsulated in monitors)

message passing is more appropriate

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

functions to create and handle interrupts

A

Interrupt(process id, interrupt number) - service call letting a process cause an interrupt in another

Handle(interrupt number, handler) - associates a handler with an interrupt

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

When a software interrupt is initiated what is allowed to be communicated?

A

Software interrupts allow only one bit information to be communicated -
that an event associated with the interrupt number has occurred.

They are typically used by an operating system to inform a process about the following events:

  • The user typed the ``attention key’’.
  • An alarm scheduled by the process has expired.
  • Some limit, such as file size or virtual time, has been exceeded.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are Interrupt traps, software interrupts, and exceptions?

A

With all of them an event is processed asynchronously by a handler procedure.

Interrupt and trap numbers defined by hardware which is also responsible for calling the procedure in kernel

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

Interrupt handler vs trap handler

A

Interrupt handler called in response to a signal from another device

while a trap handler is called in response to an instruction executed within the cpu

17
Q

where are interrupt and exception handlers called?

A

the user space

18
Q

A software interrupt handler is called in response to what?

A

the invocation of a system call

what does this mean ??? grrrr

19
Q

What are software interrupt numbers defined by?

A

The operating system

20
Q

What are exceptions defined and processed by?

A

The programming language

21
Q

Does the raiser of an exception identify which process should handle it?

A

No. meaning that exceptions are not IPC (inter-process communication) mechanisms

22
Q

What are Software interrupts when referred to in a PC environment?

A

traps to kernel-provided I/O routines

23
Q

What is the special instruction on the PC called INT for?

A

it invokes traps in PC environment or ‘Software interrupts’

Ex. int 16H (executes BIOS interrupt routine for processing the current character received from keyboard)

24
Q

What is the term Software interrupts similar to in Linux/ Unix?

A

signals

25
Q

Are signals (as seen in Linux/ Unix) or software interrupts the same thing as semaphores?

A

No, they are different.

But you do use the ‘signal’ operation on both