Multithreading Flashcards

Learn concepts that the understanding of multithreading

1
Q

What does the preprocessor do in the program creation process?

A

It processes directives (e.g., macros, file inclusions, conditional compilations) to transform the source code before compilation.

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

What is the role of the compiler in program creation?

A

The compiler translates source code into machine code by performing syntax and semantic analysis, optimizations, and code generation.

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

What does an assembler do in the program creation process?

A

It converts assembly language code into machine code by translating mnemonic instructions into binary representations.

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

What is the function of the linker in program creation?

A

The linker combines object files into a single executable by resolving external symbols and organizing the memory layout.

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

What is a thread?

A

A thread is the smallest unit of execution within a process, managed by the scheduler.

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

How is parallelism defined in computing?

A

Parallelism is the simultaneous execution of multiple computations or processes to improve performance.

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

What does concurrency mean in computing?

A

Ability to manage multiple tasks at the same time and switch between them as needed

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

What is data parallelism?

A

It is the execution of the same operation concurrently on different pieces of distributed data.

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

What is task parallelism?

A

Task parallelism is the concurrent execution of different tasks or functions that perform distinct operations independently.

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

What are kernel threads?

A

Kernel threads are threads managed directly by the operating system, which handles their scheduling and resource allocation.

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

What are user threads?

A

User threads are threads managed by a user-level library rather than directly by the operating system.

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

What is the many-to-one threading model?

A

It is a model where many user-level threads are mapped to a single kernel thread.

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

What is the purpose of the many-to-one threading model?

A

Its purpose is to simplify thread management at the user level.

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

What is one advantage of the many-to-one threading model?

A

It offers efficient context switching with less overhead.

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

What is one disadvantage of the many-to-one threading model?

A

A blocking system call can block all threads, and it cannot utilize multiple processors concurrently.

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

What is the one-to-one threading model?

A

It is a model where each user-level thread is mapped to a unique kernel thread.

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

What is the purpose of the one-to-one threading model?

A

Its purpose is to allow true parallel execution on multiprocessor systems.

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

What is one advantage of the one-to-one threading model?

A

It provides better concurrency and true parallelism.

19
Q

What is one disadvantage of the one-to-one threading model?

A

It increases overhead and consumes more system resources due to managing many kernel threads.

20
Q

What is the many-to-many threading model?

A

It is a model where many user threads are mapped to many kernel threads.

21
Q

What is the purpose of the many-to-many threading model?

A

Its purpose is to combine the benefits of user-level and kernel-level threading by providing flexible scheduling.

22
Q

What is one advantage of the many-to-many threading model?

A

It allows efficient resource use and flexible scheduling of threads.

23
Q

What is one disadvantage of the many-to-many threading model?

A

Its implementation is more complex and may introduce mapping overhead.

24
Q

What are Pthreads?

A

Pthreads (POSIX Threads) is a standardized API for creating and managing threads in UNIX-like operating systems.

25
Q

What are threading directives?

A

They are compiler-specific instructions (such as those used in OpenMP) that guide the compiler in parallelizing code.

26
Q

What is implicit threading?

A

Implicit threading automatically handles thread creation and workload distribution, reducing the need for explicit thread management by the programmer.

27
Q

What is a thread pool?

A

A thread pool is a collection of pre-created threads that are available to execute tasks, reducing the overhead of thread creation.

28
Q

What is OpenMP?

A

OpenMP is an API that supports shared-memory parallel programming in C, C++, and Fortran through compiler directives, runtime routines, and environment variables.

29
Q

What is a signal in computing?

A

A signal is a notification sent to a process to inform it of an event like an interrupt, exception, or other system condition.

30
Q

What is a synchronous signal?

A

It is a signal generated as a direct result of a process’s actions, such as an arithmetic error.

31
Q

What is an asynchronous signal?

A

It is a signal generated by external events (e.g., hardware interrupts or user actions) that can occur at any time during execution.

32
Q

What is the default signal handler?

A

It is the system-provided function that handles signals when no custom handler is specified.

33
Q

What is a user-defined signal handler?

A

It is a custom function written by the programmer to handle specific signals in a tailored manner.

34
Q

What is thread cancellation?

A

Thread cancellation is the process of terminating a thread before its natural completion.

35
Q

What is a targeted thread in the context of cancellation?

A

It is the specific thread chosen to be terminated during a cancellation request.

36
Q

What is asynchronous thread cancellation?

A

It terminates a thread immediately, regardless of its current state, without waiting for a safe termination point.

37
Q

What is deferred thread cancellation?

A

It allows a thread to periodically check for cancellation requests at designated safe points before terminating.

38
Q

What is a cancellation point in thread cancellation?

A

It is a designated point in a thread’s execution where it checks for any pending cancellation requests.

39
Q

What is a cleanup handler in the context of thread cancellation?

A

It is a function that performs resource deallocation or other necessary cleanup when a thread is cancelled.

40
Q

What is thread local storage?

A

It provides each thread with its own private storage area, ensuring that data is not shared inadvertently among threads.

41
Q

What is a lightweight process (LWP)?

A

A lightweight process is similar to a thread; it shares resources with other LWPs but maintains its own execution context for efficiency.

42
Q

What are scheduler activations?

A

They are a technique that allows the kernel to notify a user-space thread scheduler about events like I/O completions, bridging kernel and user-level thread management.

43
Q

What is an upcall?

A

It is a callback mechanism where the kernel notifies a user-level process or scheduler about events requiring intervention, such as I/O events.