1.3 Processes and Threads Flashcards

1
Q

What is a Process?

A
  • A running instance of a program
  • Code written in program, that is being executed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How are multiple Processes Managed?

A

Process Control block is essential for managing multiple processes and allows for pause and resume

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

What is the Process Control Block?

A

A data structure stored in main memory
Collects all information about Process:
* Process ID
* Register Contents
* Memory space
* Asociated User or open Files

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

What is there are more processes then CPU cores?

A
  • It uses Multitasking and Multiprocessing techniques to manage multiple processes
  • OS switches between processes allowing each to execute each time slice
  • This is achieved by storing program counter in Process control block
  • Pause/resume
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Multitasking vs. Multiprocessing

A

Multitasking
* Several processes in the system are executed quasi-parallel (also called “interleaved” or “concurrent”) by constantly changing the process being executed on one CPU.

Multiprocessing
* If there is more than one CPU or multiple cores in a system, multitasking is extended to multiprocessing, which enables true parallel processing.

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

Polling

A

Actively waiting by continuously querying the status of an I/O operation is called polling. The disadvantage of this approach is that the CPU is busy waiting and therefore unavailable for other processes.

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

What are process states?

A
  • Can be found in entry of Process Control Block

Active
* Currently Processed by CPU

Ready
* Ready to be executed as soon as CPU available

Waiting
* Process cannot continue
* Lacks Data/wait for resources
* Requests via system calls

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

What is Preemptive Multitasking?

A

Allows the CPU to take control von currently running non-cooperactive processes
* Processes that naever make system calls

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

How does Preemptive Multitasking work?

A
  1. Hardware Alarm Clock sets maximum time slices before process begins
  2. Interrupt Handling once time slice expires
  3. Process switching, OS takes control
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a Thread?

A
  • Smallest Sequence of programmed instructions
  • Subset of a programm
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Thread Programming?

A

Special application programming interfaces (APIs) (e.g., the POSIX thread API, Windows thread API, Java threads) program threads of execution, which comprise a sequence of instructions within a process. After each sequence, a thread change can take place.

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

How to threads enable parrallel processing?

A

By concurrent execution of functions

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

What types of Threads are there?

A

User Level Threads
* Implemented at application level
* Without Kernel Intervention

Kernel Level Threads
* Recognized and managed by OS directly
* Can run on different processors
* Resource Intensive

Hardware Level Threads
* Allows single CPU to execute multiple threads simultaneously
* Hyper threding

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

Q2: Explain with examples the difference between user-level threads and kernel-level threads.

A

User-level threads and kernel-level threads are two types of threads that exist.

User-level threads are created and managed without kernel intervention, making them more light-weight and better for fine-grained control. However, because the operating system is not aware of their existence, if a user-level thread gets blocked on I/O then all threads within the process are blocked. An example could be a chatting program, where you would want to handle input and output independent of each other.

Kernel-level threads, on the other hand, are directly managed by the operating system, making them slower to create and manage, but also more robust. They are scheduled by the operating system, and have more system privileges than user-level threads. An example could be a large data-processing program that carries out several tasks, and each task would not want to be impacted by other tasks.

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