Threads and Multithreading Flashcards

1
Q

What is a thread

A

A thread is a lightweight process that shares a common address space with the owner process

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

Advantages of using threads

A

They are easy to create and handle
They achieve concurrency in parallel programming
They can effectively utilize multiprocessor architecture
Thread communication is much faster than process communication because threads share common address space
They increase the overall performance of a system.

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

What are the classifications of threads?

A

User level threads: These threads are independent of the kernel
Kernel level threads: These are created by the operating system directly

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

Advantages of User level threads

A

They are easy to create
They are platform independent
They don’t depend upon the system hardware
Context switching is very easy for an OS

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

Disadvantages of User level threads

A

Multiprocessing is very difficult because it is independent of kernel.
They require non blokcing I/O

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

Advantages of kernel level threads

A

Mulitiprocessing is done very easily
They work on the blocking I/O protocol

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

Disadvantages of kernel

A

They are slow and inefficeient compared to user level threads
They are very hard to create and manage
Multiple switching is required to transfer control from one thread to another thread.

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

Threads vs Processes

A

D C R - T M

Definiton: A thread is a lightweight segment that is part of a process while a process is any program that is executing

Creation Time: Threads usually take very little time to create since its lightweight while Process requires more time to create.

Resource sharing - Threads need minimal resources to do its task while a process uses more resources than threads

Termination Time: Threads takes littel time to terminate while a process takes more time to terminate due to its complex nature

Management - Threads do not depend on any OS system calls while a process depends on system calls

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

What is multi-threading

A

This a program’s ability to execute multiple threads simultaneously to maximize the utilization of the CPU

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

Importance of Multithreading

A

Application scalablity
Responsiveness
Efficient memory utilization
Efficent CPU utilization

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

What is concurrency

A

This is parallelly executing multiple threads at the same time.

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