ECM 1413 Processes Flashcards

1
Q
  • A program:
A
  • is a set of instructions for performing a specific task (passive)
  • is stored on disk
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  • A process:
A
  • An instance of a program in execution (active)
  • requires CPU resources, memory and I/O
  • Multiple process instances of one program
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why do we use processes?

A

Modularity
Simplifies OS development

Speedup through parallelism
Subdivision of tasks so they can be ran in parallel

Security and stability through isolation

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

nodes of the process lifecycle

A

born
ready
waiting
running
died

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

Born/new

A

process created but not admitted

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

Ready

A

process in main memory, ready to execute

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

Running

A

The process has been allocated to a cpu pool and is currently running
The processor might the running of a process on the grounds of an interrupt or timeout and it is back to the ready state

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

What is a Pressure Control Block (PCB)

A

Data structure that stores information, details, metadata, about a block. It is important in context switching
Usually every process has parent (except the first). As such, each process stores the ID of the parent process
PCB is the Kernel’s representation of the process

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

Context Switching. Context:

A

the current state of the process (the files it has access to, the condition of the variables in the process)

- A context switch is pure overhead
- Time required varies with factors like the number of registers that must be copied
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

To stop running process 1 and start process 2:

A

1) Change the state of process 1 from running to ready
2) Save the context of process (since it’s back in ready, we will need to use it later again)
3) Load the context of process 2
4) Change the process scheduling state of process 2

This whole process is referred to as a context switch or process switch

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

Overhead:

A

any combination of excess or indirect computation time, memory, bandwidth, or other resources that are required to perform a specific task.

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

With too few context switching:

A
  • There will be the starvation of some processes. No fairness between the processes as some will have to wait too long
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

With too many context switching:

A
  • Takes too many resources and causes slowdown on overhead
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Layout of process in memory

A

Stack
Heap
data
Text

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

Text

A

The actual executable code; fixed-size and read-only

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

Data

A

Global and static variables; Fixed-size - determined at compile time

17
Q

Heap

A

Memory that is dynamically allocated during runtime; Size can shrink/grow

18
Q

Stack

A

Temporary storage (function parameters, return addresses and local variables) ; Size shrinks/grows

19
Q

Stack as a data structure

A

A LIFO (Last In First Out) data structure
Operations:
- Push: adding to the stack
- Pop: removing from the stack
Upon Function Call: Activation record (parameters, local variables, return address) pushed to stack
Upon Function Return: Activation record popped from stack

20
Q

The Heap as a data structure

A

Dynamically allocated (grows or shrinks based on the needs of the process), the only similarity to a stack
Blocks of memory are allocated and removed in an arbitrary (any) order
Used when you need:
- To store a large block of memory for a longer period of time
- Variables that can change size dynamically
If allocated during runtime, it goes onto the heap

21
Q

Process spawning:

A

The method by which a process (parent) creates a new process (child)

22
Q

In Linux there are four system calls for process spawning

A

fork
exec
wait
exit

23
Q

What is forking

A

Fork creates a child process with a unique process ID. The child is a copy of the parent process
Fork returns
* 0 to the child process
* the process ID of the child process to the parent process

24
Q

Wait

A

parent process is put in waiting state until child process finishes

25
Q

Exit

A

when done, the child process issues the exit system call, and the parent process can resume.