Lecture 2: Process / Shell (Part 1) Flashcards

1
Q

Process Information includes 3 things:

A

1) Process Stack
2) Data Section
3) Heap

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

Define: Process Stack of Process Info

A

Includes temporary data:

  • function parameters
  • local variables
  • return address
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Define: Data Section of Process Info

A

Includes global variables

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

Define: Heap of Process Info

A

Memory that is dynamically allocated during run-time

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

Program code of a process is known as:

A

text section

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

State the 4 process states:

A

1) New
2) Running
3) Waiting
4) Terminated

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

How is a process represented in the Operating System (OS)?

A

As a Process Control Block.

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

What is included in a Process Control Block?

A

Info related to program execution and context info such as:

  • PID
  • Process State
  • Program counter
  • CPU Registers
  • CPU_Scheduling info
  • Memory-Management info
  • I/O Status
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

List the 7 broad categories of Operating System services:

A

1) User Interface
2) Program Executions
3) I/O Operations
4) File Manipulations
5) Resource Allocation
6) Accounting
7) Protection and Security

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

Define: Shell

A

An interface between user and OS to access OS services. Is a Command Interpreter (a program that accepts commands from the user and interprets the commands)

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

When using the Shell, the execution of a command is done by ________. What does the Shell make use of when carrying out commands?

A

A separate process (child process) from the shell process. Makes use of System Calls.

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

Does the shell wait for command processes to finish before the user can use it again or can you always use the shell process?

A

You have to wait (unless you initiate command with the AND sign which runs the command in the background)

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

When a fork system call is made, what does the child process inherit from the parent?

A

The parent’s state: Same program instructions, variables have the same values, same position in the code. (Parent and child have separate copies of that state).

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

What does fork() return when called?

A

PID to parent; 0 to child if successful. Else, -1 if failure to fork.

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

If a failure occurs, what will be the main reason behind the failure?

A

Failure occurs when the limit of processes that can be created is reached.

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

How many returns occur during a fork() system call?

A

Twice: one to parent, one to child

17
Q

What does the wait() function do?

A

Used to terminate the parent process when the child terminates

18
Q

During execution, output interleaving is: (Nondeterministic or deterministic?)

A

Nondeterministic

19
Q

Define: Nondeterministic

A

Cannot determine output by looking at code

20
Q

Regarding a fork system call, what is the cause behind a failed fork (ie. when fork() returns -1 to parent and sets errno)?

A

When the limit of processes that can be created is reached

21
Q

Every process has what kind of table associated with it?

A

A Process File Descriptor Table

22
Q

What does an entry in a process’s Process File Descriptor Table represent?

A

Each entry represents something that can be read from or written to. Such as:

  • file
  • screen
  • pipe
23
Q

of Processes as a result of n forks is given by:

A

2^n - 1