Lecture 4 Flashcards

1
Q

What’s special about Fork()’s return?

A

It returns twice (0 to child, PID of new process to parent)

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

execlp() command ____ current program

A

Overwrites

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

What is exit()

A

Process executes last statement and asks OS to delete it

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

What happens when a process terminates?

A

Process’ resources are de-allocated by OS and outputs data from child to parent via wait()

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

What is abort()

A

Parent terminating execution of child processes

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

Why is abort() called?

A
  • Child has exceeded allocated resources
  • Task assigned to child is no longer required
  • If parent is exiting, some OS do not allow children to continue (causes cascade termination)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Zombie Process

A

Process terminated but parent hasn’t called wait() yet

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

Where is the return value of a zombie process kept?

A

Held in memory

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

Orphan Process

A

Process is running but parent exited without calling wait()

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

What is adoption?

A

An orphan process being assigned a new parent (init process in Linux)

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

Thread

A

A sequence of instructions in a function that a CPU can execute as a unit

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

Thread is comprised of (from OS perspective):

A
  • Program Counter
  • Register Set
  • Stack
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Process is composed of…

A

…one or more threads

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

Threads belonging to the same process share:

A
  • Code section
  • Data section
  • OS resources such as open files and signals
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Why multithreading?

A
  • Responsiveness
  • Resource Sharing
  • Economy
  • Stability
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Threads can be created and managed at two levels:

A

User-level threads and kernel-level threads

17
Q

User Level Thread

A
  • All Data Structures are maintained in user level
  • All thread operations are performed in user level
  • Kernel knows nothing about user-level threads
  • Provided by user-level libraries
18
Q

Kernel Level Thread

A
  • All data structures maintained in kernel space
  • All thread operations need system calls to perform them
  • Provided by the OS
19
Q

Mapping from user-level to kernel-level threads can be:

A
  • Many-to-many
  • One-to-one
  • Many-to-one
20
Q

Many-to-one

A
  • Many user-level threads mapped to one kernel-level thread

- Thread management is done in user level

21
Q

Pros and cons of many-to-one

A
  • Pro: Managing user-level threads is faster (no system calls, no switching to kernel mode)
  • Con: One thread blocks, the entire process blocks; cannot use multiprocessors
22
Q

One-to-one

A

Each user-level thread mapped to one kernel-level thread

23
Q

Pros and cons of one-to-one

A
  • Pro: Can use multiprocessors; one thread blocks, the others can run
  • Con: Thread management overhead; creating too many kernel threads may degrade performance since they consume OS resources