Lesson 6: Multi-threading and Concurrent Programming Flashcards

1
Q

Scheduling algorithms do not determine when to stop one process and give CPU
time to another process. True or false?

A

False, they DO determine

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

A thread can be created by extending the Thread class, or by implementing the Runnable interface. True or false?

A

True

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

The process is using the CPU (it has been allocated processor time and the processes machine code is physically executed by the processor.)

A

Running

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

Transition 2 is usually triggered by a processor interruption signal generated by the corresponding I/O peripheral or a network interface. True or false?

A

False, Transition 4

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

The use of uni-programming was a feasible solution for the early computers. True or false?

A

True

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

Current CPU architectures
require less processing units (cores), which increase the parallel processing capacity of the machine. True or false?

A

False, involve multiple processing units (cores)

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

Less complex and faster than process context switching, making multi-threading an efficient way to emulate parallelism.

A

Thread context switching

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

A transition is caused by the process scheduler when it decides to give a ready process the chance to run.

A

Transition 3

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

The process is ready to run (does not have to wait for any event to occur), but it is temporarily stopped

A

Ready (Runnable)

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

Non-preemptive scheduling usually happens when the currently running process has to switch to the BLOCKED state, while waiting for an external event. True or false?

A

True

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

In this software approach,
parallel processing requires
that the operating systems
perform fast switching of CPU
between different processes.

A

Multi-tasking paradigm

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

Thread priorities have to be managed according to the application purpose and requirements. True or false?

A

True

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

Shortest remaining job first involves giving priority to processes which are about to
finish their operation, leading to a faster de-congestion of the process queue. True or false?

A

True

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

This method of the Thread class is overridden here to perform the core activity of the tasks.

A

run()

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

The first process in the queue of READY process will be allocated processor time.

A

First come–first served

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

When multiple threads exist,
different tasks can be performed in parallel using common data and resources. True or false?

A

True

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

The solution to the uni-programming problem is represented by the
multi-tasking paradigm. True or false?

A

False, multi-programming

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

The processes requiring the
shortest time to complete will be given the highest priority.

A

Shortest remaining job first

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

A thread which manages time-critical tasks should be given lower priority than the other threads. True or false?

A

False, higher priority

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

Threads may be allocated different priorities
depending on their role within the application process. True or false?

A

True

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

Transitions 2 and 3 are basically creating an illusion of processing parallelism. True or false?

A

True

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

Despite the evident benefits multi-threading brings, in terms of application design, the number of threads should be kept to the minimum, in order not to overload the system with non-necessary context switches. True or false?

A

True

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

A call to this method determines the threads to suspend their execution.

A

sleep()

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

Emerged as a processor allocation paradigm
where multiple user programs run on the same computer at the same time.

A

Multi-programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
The **READY state** employs a scheduling algorithm to determine the processes which will be allocated processor time and in what order. True or false?
True
26
Mainly determined by the fact that threads own less resources than processes which need to be saved prior to switching the context
Thread switching efficiency
27
The development of personal computers, and the related diversification in application types **determined a definite trend towards widening of user processing requirements**. True or false?
True
28
When multiple processes are in the **RUNNING state**, the operating system must decide which one of them to run first. True or False?
False, READY
29
Threads can **run in preemptive mode** (operating system interrupts thread execution at regular intervals to give processing time to other threads) or in cooperative mode (a thread can access the CPU for as long as it needs). True or false?
True
30
A sequence of a program that performs certain tasks and executes within a process.
Thread
31
A transition occurs when a process cannot continue, as it is waiting for some external event
Transition 1
32
It **creates the illusion of concurrency (parallel execution of user programs) by allocating chunks of processor time to each of the running applications sequentially**.
Multi-tasking
33
Such an example of multi-threading is the **graphical user interface (GUI)** which should be allocated a dedicated thread with a higher priority than other threads. True or false?
True
34
Preemptive scheduling **can be performed according to a scheduling policy**. True or false?
True
35
This can be associated to the thread during its creation and can be changed during the operation of the thread.
Thread priority
36
Scheduling algorithms may do this voluntary (**“non-preemptive scheduling”**)or forced (**“preemptive scheduling”**). True or false?
True
37
Often threads are seen as **heavyweight processes**, as they have their own stack, but share memory and data as well as descriptors of resources with other threads within the same process. True or false?
False, lightweight
38
Threads should be employed when there are clear benefits from using parallel processing only, as involving multi-threading in a highly sequential series of tasks only adds complexity to otherwise a simple solution. True or false?
True
39
It provides another level of parallelism for task execution, with less overhead.
Multi-threading
40
A transition occurs when the external event that the blocked process was waiting for (such as the arrival of some input messages) occurs.
Transition 4
41
First come–first served **treats all the process unequally**, and there is no method to prioritize critical processes. True or false?
False, EQUALLY
42
It is a term used to describe a simple type of operating system design in which a **computer system executes only one program at a time**.
Uni-programming
43
As a result the **threads will be in the BLOCKED state** until the sleep duration of time indicated when sleep() was called **elapses and the threads return to the READY state**. True or false?
True
44
The **run() method** is invoked by the **start() method**, when the thread is started. True or false?
True
45
Processes with higher priority will be allocated processor time more often.
Priority Scheduling
46
Equal processor time slices are assigned to all processes.
Round-robin
47
In a multi-tasking paradigm, as a consequence, at any given time a single process **runs on any multiple processing unit (core)**. True or false?
False, only runs on any one processing unit (core).
48
It involves **only one user program running on any computer at a time.**
Uni-programming
49
The main problem with multi-programming is the **limited number of CPUs (often a single one) the host machine has**. True or false?
True
50
The **process context** includes the process state, an image of the executable machine code corresponding to the program, allocated memory, descriptors of resources used by the process such as file descriptors or handlers, security attributes such as process owner and process permissions, and last, but not least, processor state like content of registers and physical memory addressing. True or false?
True
51
When preemptive scheduling is used, the **currently running process is forced into the READY state** to allow other processes to run. True or false?
True
52
The process is unable to run until some external event occurs (e.g., data is received from the network). CPU could be free during this period if none of the existing processes is in position to run.
Blocked
53
Two implementations of multi-threading:
* Extending Thread class * Implementing Runnable class
54
Is an important feature when critical applications are running on the host machine.
Process priority
55
Application development and deployment has **moved forward and further benefits from the already described processing parallelism** by assigning the same application’s tasks to multiple processes which can individually request CPU time. True or false?
True
56
In general, a **process consists of many threads**, each running at the same time within the process context and performing a unique task. True or false?
True
57
When less important tasks or less time-critical applications run (e.g., operating system updates), they may be allocated **higher priority** in order to minimize the impact on other running applications. True or false?
False, lower
58
It is a running program sequence along with all the resources that its code can affect (also known as process context).
Process
59
It involves the processes giving up processor time willingly to allow other processes to run.
Non-preemptive scheduling
60
A transition is caused by the process scheduler when it decides to temporarily stop the execution of the current process and give another process a chance to run.
Transition 2