Processes & Threads Flashcards

1
Q

What are CPU activities called?

A
  • A batch system executes jobs
  • A time-shared system had user programs or tasks
  • Common term for all processes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are programs?

A
  • A program is a passive entity, stored on disk (or other media).
    waiting to be executed
  • Once active, we refer to its instantiation as a process
  • Single programme: may invoke multiple individual processes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does Text Segment (Code) store?

A
  • Stores the executable code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does Data Segment store?

A

Stores global and static variables

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

What does the Heap segment do?

A

Used for dynamic memory allocation at
run time
* Grows upward in memory as more
memory is allocated.
* Shrinks when memory is freed

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

What is the Stack Segment?

A
  • Temporary data
  • Stores function calls, local variables, and return addresses.
  • Grows downward in memory.
  • Each function call creates a new stack frame.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the 5 step that a OS manages New Process?

A

Typical steps OS follows when creating a process
1. Allocates memory
2. Assigns a unique Process ID (PID)
3. Loads executable code into memory
4. Sets up the process’s execution context – PCB etc.
5. Schedules the process for execution

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

What is the Scheduling Processes aim?

A

To maximise CPU usage

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

What are the 4 (Scheduling Processes)

A
  • Job queue (long-term scheduler)
  • Ready queue (short-term scheduler)
  • Device queue (for each device)
    • I/O requests awaiting completion
  • Swapped-out queue (medium-term scheduler)
  • Management of processes that cannot make progress towards
    completion
  • Free up space for other processes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

To manage and control processes, OS must know what?

A
  • Process location
  • Process attributes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is IPC?

A

Inter-Process Communication (IPC) is a mechanism that
allows processes to communicate and share data.
* Processes run independently and have separate memory
spaces
* IPC enables them to exchange information efficiently.

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

Why is IPC needed?

A

Processes often work together - need to share data.
* Some processes depend on each other’s output
* e.g., a producer process creates data, and a consumer process
uses it
* Processes need to synchronise their execution (e.g., avoiding
race conditions)

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

What are Threads?

A

A thread or lightweight process is a particular execution
path within a larger process
* They share the process’s resources (memory, files, etc.)
* They have independent execution flows.

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

Multithreading Benefits

A

Responsiveness
* May allow a program to continue running even if part of it is blocked or performing
a lengthy operation

Resource sharing
* Processes can only share resources through techniques such as shared memory
and message passing.
* Threads share the memory and resources of the process by default

Economy
* Allocating memory and resources for process creation is costly.
* Threads share the resources of the process. Thus, it is more economical to create
and context-switch threads.

Scalability
* A single thread process can only run single core
* Multi thread process can run in parallel across multiple cores

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