PART 3 - PROCESSES Flashcards

1
Q

What is the process model?

A

The process model is the abstraction of a running program.

  • It is a program in execution.
  • Many processes can run the same program text
  • Each process has its own address space (isolation)
  • A (parent) process can create/fork (child) processes

Provide (pseudo) concurrent operation even on single CPU (multiple virtual CPUs).

Pseudo parallelism versus multiprocessor system.

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

What is the conceptual model?

Hints: (Independent, Logical Program Counter - Real Physical Program Counter)

A

Each process is independent

Each process has own program counter, registers and variables, and flow of control.

To run process, copy LOGICAL PROGRAM COUNTER into the REAL, PHYSICAL PROGRAM COUNTER.

When switch, value of the PHYSICAL PROGRAM COUNTER is stored in the PROCESS LOGICAL PROGRAM COUNTER in memory.

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

Explain how Processes work over time

A

Over a long period of time, all processes make progress.
-At any given instance only one process is active (Assuming single CPU)

CPUs switch rapidly between processes
-The rate of progress is not uniform, predictable or reproducible (You cannot predict that the same process will perform the same).

You cannot make assumptions about timing
-Cannot make assumptions at where the process will be in t+20 secs.

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

What is a program?

A

Program is an algorithm expressed in a programming language or other notation.

Program is the thing we write as programmers.

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

What is a process?

A

Process is an ACTIVITY that is EXECUTING ON A PROCESSOR.

A process has a program text, input, output, state etc.

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

Explain interrupt and switching of processes

A

1) Another activity (process) requires the CPU
2) Save state of the current process.
- the current process is on the CPU. Save everything you need in order to be able to restart the process.
3) Switch to a higher priority process (or next in line) with its own program and state.

Also, two distinct processes may execute the same program

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

Explain the process lifecycle and states

A

Processes have a lifecycle that is managed by the Operating System.

The operating system manages everything FROM CREATION TO TERMINATION, through intermediate states.

In simple systems (eg. microwave controller) all processes are created at system startup.

In general-purpose systems we need to create and terminate processes during system operation.

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

Explain the two ways a program can terminate (Voluntary & Involuntary)

A

Termination is either:
VOLUNTARY: Under the control of the process

-normal exit, error exit (Typically invalid user error)

INVOLUNTARY: Outside the control of the process

-Fatal error, Killed by another process

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

What is high-level process abstraction?

A

It views the whole system as a collection of processes, everything running on your system is a process.

Some processes perform user tasks, others perform system tasks.

The scheduler manages interrupt handling, starting and stopping processes.

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

Describe processes in MINIX

A

MINIX 3 is structured as a collection of processes

  • It is Microkernel
  • Processes, including system processes, communicate with each other using inter-process communication (IPC)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the process initialisation?

A

1) The kernel starts the SYSTEM and CLOCK TASKS.
2) The kernel STARTS the PROCESS MANAGER and FILE SYSTEM processes.
3) Process manager and file system cooperate to start other servers and drivers in the boot image.

  • Each server and driver runs, initialises itself and then blocks
  • Once all tasks, drivers, and servers loaded from the boot image have blocked, init, the first user process is executed.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are kernel calls?

A

Kernel calls are Low-level functions that are provided by the system task

• Interface provided by kernel layer to system processes (drivers and servers) in layers 2 and 3
• Allow drivers and servers to do their work
• E.g. requesting to read a hardware I/O port
– Not accessible to user processes in layer 4

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

What are system calls?

A

Standards-comliant, high-level calls such as open, read, stat, fork

-Interface provided by layer 3 server processes to layer 4 user processes

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

What is Inter-process Communication (IPC) in MINIX?

A

Processes communicate by sending messages to each other (through the kernel).

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

Explain the three primary primitives of IPC

send, receive, sendrec

A

The three primary primitives of IPC:

– send(dest, &message) to send a message to
process dest
– receive(src, &message) to receive (wait) for a
message from process src (or ANY process)
– sendrec(src_dst, &message) to send and
receive a message to/from process src_dst

&message is the address of the location of the
message (e.g. where the kernel copies to/from)

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

Give two advantages of rendezvous message passing.

A

1) Simple to implement
2) No need to MANAGE BUFFERS (there is no more than one message) of sent but not yet received messages.
3) All messages of fixed length are known at compile time.

17
Q

Explain how deadlock can occur in rendezvous message passing.

A

A deadlock can occur if process A initiates a send to process B at the same time as process B.

Neither process can make progress because:
-A is blocked waiting for B to invoke (summon) receive, but B cannot invoke receive because it is blocked waiting for A to invoke receive

18
Q

How does Minix prevent deadlock in rendezvous message passing?

A

• Message ordering by layer (user > server > driver)

• User processes can only use SENDREC – enforces send then receive
– Cannot communicate directly with drivers, must go through
server POSIX interface

  • Kernel restricts other IPC (eg: keyboard driver cannot message sound driver)
  • Message up layers from kernel to driver or server (e.g. interrupt or alarm) by asynchronous (non-blocking) notify.
  • Last resort: deadlock detection in kernel denies offending process and returns error message.
19
Q

What is non-blocking notify(dest) primitive?

A
  • The sender issues notification and continues (does not wait for destination to call receive).
  • The notifications are “picked up” the next time the destination calls receive
  • It is used to send very little information, often only need to know which process issued notification.