Lesson 6: Multi-threading and Concurrent Programming Flashcards
Scheduling algorithms do not determine when to stop one process and give CPU
time to another process.
False, they DO determine
A thread can be created by extending the Thread class, or by implementing the Runnable interface.
True
The process is using the CPU (it has been allocated processor time and the processes machine code is physically executed by the processor.)
Running
Transition 2 is usually triggered by a processor interruption signal generated by the corresponding I/O peripheral or a network interface.
False, Transition 4
The use of uni-programing was a feasible solution for the early computers. True or false?
True
Current CPU architectures
require less processing units (cores), which increase the parallel processing capacity of the machine. True or false?
False, involve multiple processing units (cores)
Less complex and faster than process context switching, making multi-threading an efficient way to emulate parallelism.
Thread context switching
Caused by the process scheduler when it decides to give a ready process the chance to run.
Transition 3
The process is ready to run (does not have to wait for any event to occur), but it is temporarily stopped
Ready (Runnable)
Non-preemptive scheduling usually happens when the currently running process has to switch to the BLOCKED state, while waiting for external event.
True
In this software approach,
parallel processing requires
that the operating systems
perform fast switching of CPU
between different processes.
Multi-tasking paradigm
Thread priorities have to be managed according to the application purpose and requirements.
True
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
This method of the Thread class is overridden here to perform the core activity of the tasks.
run()
The first process in the queue of READY process will be allocated processor time.
First come–first served
When multiple threads exist,
different tasks can be performed in parallel using common data
and resources.
True
The solution to the uni-programming problem is represented by the
multi-tasking paradigm. True or false?
False, multi-programming
The processes requiring the
shortest time to complete will be given the highest priority.
Shortest remaining job first
A thread which manages time-critical tasks should be given lower priority than the other threads.
False, higher priority
Threads may be allocated different priorities
depending on their role within the application process.
True
Transitions 2 and 3 are basically creating an illusion of processing parallelism. True or false?
True
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
A call to this method determines the threads to suspend their execution.
sleep()
Emerged as a processor allocation paradigm
where multiple user programs run on the same computer at the same time.
Multi-programming
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
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
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
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
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
A sequence of a program that performs certain tasks
and executes within a process.
Thread
Occurs when a process cannot continue, as it is waiting for some external event
Transition 1
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
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
Preemptive scheduling can be performed according to a
scheduling policy.
True
This can be associated to the thread during its creation
and can be changed during the operation of the thread.
Thread priority
Scheduling algorithms may do this voluntary (“non-preemptive scheduling”)or forced (“preemptive scheduling”). True or false?
True
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.
False, lightweight
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
It provides another level of parallelism for task
execution, with less overhead.
Multi-threading
Occurs when the external event that the blocked process was waiting for (such as the arrival of some input messages) occurs.
Transition 4
First come–first served treats all the process unequally, and there is no method to prioritize critical processes.
False, EQUALLY
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
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
The run() method is invoked by the start() method, when the thread is started.
True
Processes with higher priority will be allocated processor time more often.
Priority Scheduling
Equal processor time slices are assigned to all processes.
Round-robin
In a multi-tasking paradigm, as a consequence, at any given time a single process only runs on any multiple processing unit (core). True or false?
False, runs on any one processing unit (core).
It involves only one user program running on any
computer at a time.
Uni-programming
The main problem with multi-programming is the limited number of CPUs (often a single one) the host machine has. True or false?
True
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
When preemptive scheduling is used, the currently running
process is forced into the READY state to allow other processes to
run.
True
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
Two implementations of multi-threading:
Extending Thread class, implementing Runnable class
Is an important feature when critical applications are running on the host machine.
Process priority
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
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
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.
False, lower
It is a running program sequence along with all the
resources that its code can affect (also known as process context).
Process
It involves the processes giving up processor time willingly to allow other processes to run.
Non-preemptive scheduling
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