340 Concepts - THREADS

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/18

flashcard set

Earn XP

Description and Tags

Midterm 1 Review

Last updated 6:09 PM on 3/21/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

19 Terms

1
New cards

Threads of execution

an independent sequence of instructions inside a process. each thread has its own program counter, its own stack, and it’s own execution path, but shares the process’ text section, data section, heap, open files, and network ports

2
New cards

Traditional process

has one thread of control but modern OS allows a process to have multiple threads

3
New cards

Why create new threads instead of new processes?

threads are cheaper, faster, and share memory, making them ideal for tasks w/in the same program || perf for parallel tasks inside program

CON - creating a new process is resource intensive and time consuming

4
New cards

Why create new processes instead of new threads?

Processes are isolated and fault independent (if the process crashes, others will remain unharmed).
Processes cannot access each other’s memory which is good for privacy and security.

Processes can transform into a new program (exec())

5
New cards

Fault independent

If a process crashes, the others remain unharmed.

If a thread crashes, the entire process and other threads crash too

6
New cards

What do threads share?

All threads belonging to the same process share:

1) Code/text section

2) data section (global and static)

3) heap (dynamic memory

7
New cards

What do threads not share?

1) program counter

2) register set

3) stack

8
New cards

Thread local storage (TLS)

A mechanism that allows each thread to have its own private copy of a variable that it does not share w/ other threads. “global but private”; changes in one thread are not visible to others

9
New cards

Thread pool

  • A collection of threads created at a system startup that sleep until needed (waiting state)

  • If a thread is needed, it is awakened to service the request immediately; freezes and returns when done

  • Helps avoid overhead of constantly creating and deleting threads

10
New cards

What does the thread pool limit?

It limits the total # of threads active to avoid exhausting resources

11
New cards

How to crate a thread w/ std::thread

std::thread t(funcName, arg1, arg2, …)

12
New cards

Why do we need std::thread::join()?

Join() makes the calling thread wait until the created thread finishes. It is important bc it prevents the program from ending while threads are still running

  • avoids undefined behaviour

  • ensures proper cleanup of thread resources

  • without join(), the thread becomes detached and the program may terminate early

13
New cards

Join() vs wait()

Join() is for THREADS inside the same process || share memory

Wait() is for the child PROCESSES created w/ fork() || doesn’t share memory

14
New cards

Interrupt

a hardware generated signal that alerts the CPU to an event requiring attention.
Steps: generated → reaches CPU → CPU pauses → identifies type → runs ISR → resumes

15
New cards

What are system calls treated as?

Interrupts

16
New cards
17
New cards
18
New cards
19
New cards

Explore top notes

note
0.2: Pre-Colonial America
Updated 1253d ago
0.0(0)
note
Chapter 20 - Biochemistry
Updated 1195d ago
0.0(0)
note
Hidi and Renninger: Interest
Updated 1281d ago
0.0(0)
note
Terms
Updated 1055d ago
0.0(0)
note
Apostrophes
Updated 1145d ago
0.0(0)
note
Chapter 1: Basic Economic Concepts
Updated 1335d ago
0.0(0)
note
Balladyna
Updated 1113d ago
0.0(0)
note
0.2: Pre-Colonial America
Updated 1253d ago
0.0(0)
note
Chapter 20 - Biochemistry
Updated 1195d ago
0.0(0)
note
Hidi and Renninger: Interest
Updated 1281d ago
0.0(0)
note
Terms
Updated 1055d ago
0.0(0)
note
Apostrophes
Updated 1145d ago
0.0(0)
note
Chapter 1: Basic Economic Concepts
Updated 1335d ago
0.0(0)
note
Balladyna
Updated 1113d ago
0.0(0)

Explore top flashcards

flashcards
15. Metabolism
59
Updated 515d ago
0.0(0)
flashcards
Respiratory (test 3)
48
Updated 1210d ago
0.0(0)
flashcards
Preterite and Imperfect
44
Updated 341d ago
0.0(0)
flashcards
bio exam 3!!
99
Updated 845d ago
0.0(0)
flashcards
DECA Marketing Cluster
241
Updated 772d ago
0.0(0)
flashcards
Christianity quotes
77
Updated 315d ago
0.0(0)
flashcards
15. Metabolism
59
Updated 515d ago
0.0(0)
flashcards
Respiratory (test 3)
48
Updated 1210d ago
0.0(0)
flashcards
Preterite and Imperfect
44
Updated 341d ago
0.0(0)
flashcards
bio exam 3!!
99
Updated 845d ago
0.0(0)
flashcards
DECA Marketing Cluster
241
Updated 772d ago
0.0(0)
flashcards
Christianity quotes
77
Updated 315d ago
0.0(0)