Concurrency and Multi-threading Concepts

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

1/32

flashcard set

Earn XP

Description and Tags

Flashcards covering key concepts from concurrency and multi-threading topics in computer science.

Last updated 11:00 AM on 4/6/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

33 Terms

1
New cards

Once we have multiple _____ within a process, the order in which things happen is no longer entirely __________.

threads, deterministic

2
New cards

The basic abstraction introduced for concurrency is that of a(n) __________, which breaks the classic view of a single point of execution within a program.

thread

3
New cards

Code that accesses shared data in a multi-threaded program is known as a(n) __________.

critical section

4
New cards

Each thread in a process keeps separate _____ information, including the __________ register (which keeps track of where the program is fetching instructions from).

state, PC

5
New cards

All of a thread's state information is saved in a(n) _____ ______ ______, similar to the ______ ______ _______ stored for each process.

Thread Control Block, Process Control Block

6
New cards

Without some intentional control, multi-threaded access to shared data will lead to a(n) __________, where the results depend on the timing of the code's execution.

race condition

7
New cards

In multi-threaded programs, we often want some chunk of code to execute __________, without being pre-empted before completing.

atomically

8
New cards

__________ keeps two (or more threads) from accessing shared data at the same time, avoiding race conditions.

mutual exclusion

9
New cards

All threads in a process share both code and the _____ section of memory, but each thread has its own __________ (often called thread-local storage).

heap, stack

10
New cards

To facilitate the writing of correctly-functioning concurrent programs, the _______ provides a few useful instructions we can use to build __________ primitives, which threads can then use to coordinate access to shared resources.

hardware, synchronization

11
New cards

The threading API analogous to fork() is called _____ _____.

pthread_create()

12
New cards

Unlike a fork call, the function that creates a new thread takes a(n) __________ as an argument.

function pointer

13
New cards

The most basic way of accomplishing mutual exclusion when using the pthread library is to create a(n) __________, which is a variable of type __________.

mutex, pthread_mutex

14
New cards

Because C lacks native support for generics, the thread creation function both accepts and returns a(n) __________.

void pointer

15
New cards

The threading API analogous to wait() is called __________.

pthread_join()

16
New cards

Using a separate lock for each separate shared resource is a __________ locking strategy that can increase concurrency.

fine-grained

17
New cards

Above all else, a locking mechanism must guarantee __________. Otherwise, it might allow multiple threads to enter a critical section simultaneously.

mutual exclusion

18
New cards

To use locks in a multi-threaded program, you first declare a(n) __________ variable. For the simplest type of POSIX lock, it would be of type pthread ______

lock, mutex

19
New cards

You can guarantee that a block of instructions will execute __________ by disabling ______ before starting its execution.

atomically, interrupts

20
New cards

When moving a thread from the _______ state to the blocked state due to an unavailable lock, the OS has to add the thread to a(n) __________ so it gets a fair chance to run when the lock becomes available.

running, queue

21
New cards

In general, spin locks pass the _______ criterion for locking, but fail miserably in the areas of __________ and performance.

correctness, fairness

22
New cards

When no thread is in its corresponding ______ section, the lock is said to be __________.

critical, free

23
New cards

Constantly polling a flag until its value changes is called __________. It's effective but not efficient.

spin-waiting

24
New cards

The test-and-set instruction is often known as the __________ instruction, since it swaps the contents of a register with the contents of a memory location in a single instruction.

atomic exchange

25
New cards

In the context of locking, _______ means giving each thread contending for the lock a chance at acquiring it once it's free. On the other hand, if a thread never gets a chance to run, it's said to be suffering from __________.

fairness, starvation

26
New cards

To avoid spin waiting, a thread can voluntarily move itself from the _________ state to the __________ state by calling yield().

running, ready

27
New cards

Having one big lock that is used any time any critical section is accessed is be a __________ locking strategy, which can lead to inefficiency.

coarse-grained

28
New cards

As an alternative to spin waiting, the function that acquires a lock can move the calling thread from the _______ state to the __________ state, where it doesn't take up any CPU time until the lock becomes available.

running, blocked

29
New cards

When a ______ is in the critical section guarded by a particular lock, that lock should be______ by that thread.

thread, held

30
New cards

Every ________ section in a multi-threaded program needs to be 'protected' by a(n) __________, which provides mutual exclusion.

critical, lock

31
New cards

The simplest type of POSIX lock is called a(n) __________ because it is used to provide mutual exclusion between threads.

mutex

32
New cards

Instead of spin waiting, the function that acquires a lock can use the __________ system call to force a context switch if the flag it's waiting for has not yet changed.

yield()

33
New cards

When compiling a multi-threaded program (using GCC or Clang), you have to add the __________ command-line switch to ensure the correct library is linked, and other configuration changes are made.

pthread

Explore top notes

note
APES Unit Review Packet
Updated 329d ago
0.0(0)
note
Cultural Psychology
Updated 170d ago
0.0(0)
note
Unit 4: Rhetorical Fallacies
Updated 1095d ago
0.0(0)
note
Chapter 10 Textbook
Updated 1175d ago
0.0(0)
note
The Columbian Exchange
Updated 1279d ago
0.0(0)
note
AP bio vocab quiz 6
Updated 1288d ago
0.0(0)
note
APES Unit Review Packet
Updated 329d ago
0.0(0)
note
Cultural Psychology
Updated 170d ago
0.0(0)
note
Unit 4: Rhetorical Fallacies
Updated 1095d ago
0.0(0)
note
Chapter 10 Textbook
Updated 1175d ago
0.0(0)
note
The Columbian Exchange
Updated 1279d ago
0.0(0)
note
AP bio vocab quiz 6
Updated 1288d ago
0.0(0)

Explore top flashcards

flashcards
LEC 9.3: Respirations | Vitals
24
Updated 331d ago
0.0(0)
flashcards
French Carnaval de Quebec
67
Updated 1141d ago
0.0(0)
flashcards
Interaction Design
93
Updated 821d ago
0.0(0)
flashcards
Exam 1
190
Updated 1147d ago
0.0(0)
flashcards
ENG Vocab 7-11
67
Updated 1145d ago
0.0(0)
flashcards
LEC 9.3: Respirations | Vitals
24
Updated 331d ago
0.0(0)
flashcards
French Carnaval de Quebec
67
Updated 1141d ago
0.0(0)
flashcards
Interaction Design
93
Updated 821d ago
0.0(0)
flashcards
Exam 1
190
Updated 1147d ago
0.0(0)
flashcards
ENG Vocab 7-11
67
Updated 1145d ago
0.0(0)