Processes Flashcards

1
Q

Process

A

Program in Execution. It is the basic unit of execution in an OS.

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

What must a process have to run?

A

Memory to contain the program code and data, and a set of CPU registers to support execution.

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

Process Control Block

A

Contains the information needed for a process to run. It is a data structure that defines the process to the OS. Processes are represented as PCBs to the OS.

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

What does a process state consist of?

A

Code, PC, stack, stack pointer, static data, heap, PID, values of registers, and process execution state.

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

Process Execution State

A

Can be new, ready, running, blocked, or terminated

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

What happens with the PCB when a process is created?

A

OS allocates and initializes a new PCB and places the PCB on the state queue. When a process terminates, the PCB is deallocated.

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

What happens when a process is created?

A

(1) the loader reads and interprets the executable file, (2) it sets up the process’s memory, (3) argv and argc are pushed onto the stack, (4) the loader sets the CPU registers and calls start()

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

How is fork() different in the child and parent?

A

What fork() returns. 0 in the child and the child’s PID in the parent.

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

What happens to the stack and heap in exec?

A

Overwritten!

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

Is the result of exec a same process and program?

A

No! Same process but different program.

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

exit()

A

deallocates all files and memory. If the process has a parent, it becomes a zombie

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

wait()

A

waits for the parents children. If there is a zombie process, wait returns immediately and deallocates the zombie.

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

Zombie State

A

The child is not terminated and instead holds the return value and waits for the parent to reap it.

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

Signals

A

Are vitrual interrupts. They are kernal-defined and have the signal stack and signal masking in user space

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

Besides signals, what are other forms of inter-process communication?

A

Pipes, messages, and shared memory

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

Orphan Processes

A

When a parent terminates, the child gets a new parent: init process. Children can orphan themselves to keep running in the background (nohup command).

17
Q

What process control does the OS have? (3 things)

A

Priority manipulation, debugging support, and alarms and time.

18
Q

What do CTRL-C and CTRL-Z do?

A

CTRL-C kills the program while CTRL-Z stops the program. Both are sent through kill().

19
Q

How are processes created and managed?

A

Through system calls. Fork(), exec(), wait(), etc.