Processes and Threads Flashcards

1
Q

What is a process?

A

A program in execution

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

What is a thread?

A

A basic unit of execution within a process.

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

What is a control block?

A

A data structure that contains information about a process or thread in an operating system. Whenever a process or thread is created the OS creates a CB and releases it when it is terminated.

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

True of False: Two or more separate processes cannot run the same program independently at the same time

A

False

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

Name three differences between a process and a program.

A
  1. A process has ashorter lifetime than a program.
  2. A process requires resources such as memory, CPU, Input-Output devices while a Program is stored by hard-disk and does not require any resources.
  3. A process has a dynamic instance of code and data while a program has static code and static data.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Name three differences between processes and threads.

A
  1. A process is heavy weight, a thread is light weight
  2. Process switching needs interaction with OS, thread switching does not need interaction with OS.
  3. Each process has its own memory space, while threads use the memory of the process they belong to.
  4. In multiple processor each process operates independently while one thread can read, write or change another threads data.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

List six pieces of information you might find in a control block.

A
  1. State
  2. Identifier
  3. Counter
  4. Context data
  5. CPU-scheduling info
  6. memory pointers
  7. accounting information
  8. I/O status info
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Name the four common events that can lead to the creation of a process

A

New batch job
Interactive log-on
Created by OS to provide a service
Spawned by existing process

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

Define process spawning

A

the action where OS creates a process at the explicit request of another process.

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

Name the steps that occur AFTER a new process is created.

A

Assign a unique process identifier to the new process.
Allocate space for the process.
Initialize the process control block.
Set the appropriate linkages.
Create or expand other data structures.

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

Process termination is normally due to:

A

Normal exit (voluntary).
Error exit (voluntary).
Fatal error (involuntary).
Killed by another process (involuntary).

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

Name three reasons a parent process might terminate a child process

A

The child has exceeded its usage of some of allotted resources

The task assigned to the child is no longer required

The parent is exiting, and the OS does not allow a child to continue

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

What is process switching?

A

the act of swapping out one process for another

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

Threads are divided into:

A

User level threads and kernel level threads

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

What is a User Level Thread?

A

These threads are created, managed and scheduled, and managed by a thread library operating at the user level, independent of the operating system’s kernel.

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

What is a Kernel Level Thread?

A

Supported and managed by the operating system kernel. The kernel maintains information about each thread

17
Q

Why do we use threads?

A
  1. Threads provide easier programming models
  2. Faster to create and destroy one thread than a whole process
  3. It takes less time to switch between two threads within the same process as they sahre the same memory(No context switch).
18
Q

List four characteristics of a suspended process.

A
  1. Inactive Execution State
  2. Not Utilizing CPU Resources
  3. State Preservation
  4. Can Be Resumed or Terminated
19
Q

List reasons why a mode switch between threads may be cheaper than a mode switch between
processes.

A
  1. Threads share the same address space, no need for memory management unit (MMU) reconfiguration.
  2. Minimal Kernel Involvement