Lecture 11 - Shared Memory Parallelism with Pthreads

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/23

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

24 Terms

1
New cards

Pthreads

A POSIX standard for implementing threads in C/C++ that allows multiple threads to execute within a single process.

2
New cards

Mutex

A mutex (mutual exclusion) is a locking mechanism that prevents simultaneous access to a critical section by multiple threads.

3
New cards

Critical Section

A part of the code that accesses shared resources and must be executed by only one thread at a time to avoid inconsistent results.

4
New cards

Race Condition

A situation in which the outcome of a program depends on the sequence or timing of uncontrollable events, usually due to shared variable access.

5
New cards

Semaphore

A synchronization primitive that allows threads to signal each other, often used for controlling access to a common resource.

6
New cards

Thread Safety

A property of a block of code that guarantees safe execution when accessed by multiple threads concurrently.

7
New cards

Barrier

A synchronization point where threads wait until all threads have reached it before any can proceed.

8
New cards

POSIX Threads API

A set of C functions provided for creating and controlling threads in POSIX-compliant operating systems.

9
New cards

Thread Synchronization

Mechanisms that are used to coordinate the execution of threads, ensuring that data is accessed in a controlled manner.

10
New cards

Condition Variable

A synchronization primitive that enables threads to wait for certain conditions within a mutex guarded context.

11
New cards

Read-Write Lock

A special type of lock that allows concurrent access for read operations but exclusive access for write operations.

12
New cards

Producer-Consumer Problem

A classic synchronization problem where one or more threads (producers) generate data and put it in a buffer, and another thread (consumer) takes data from that buffer.

13
New cards

Thread Creation

The process of generating a new thread of execution within a process, typically using the pthread_create function.

14
New cards

pthread_join

A Pthreads function that waits for a specified thread to terminate, allowing the main thread to synchronize with other threads.

15
New cards

Thread Count

The total number of threads that a multi-threaded program will create for execution.

16
New cards

Busy Waiting

A technique where a thread repeatedly checks for a condition, potentially wasting CPU cycles while waiting.

17
New cards

Global Variable

A variable declared outside of all functions, accessible by all threads within the same process, potentially leading to race conditions if modified.

18
New cards

Thread Function

The function that a thread executes when created, typically taking a single void pointer argument.

19
New cards

Linking with Pthreads

Including the pthread library when compiling a C program, usually with the -lpthread flag.

20
New cards

Data Race

A condition in concurrent programming where two threads access shared data at the same time, and at least one of them is a write.

21
New cards

pthread_mutex_lock

A Pthreads function that locks a mutex, blocking other threads from entering the critical section until the mutex is unlocked.

22
New cards

pthread_mutex_unlock

A Pthreads function that unlocks a mutex, allowing other threads to enter the critical section.

23
New cards

Race Condition Prevention

Techniques such as mutexes, semaphores, and barriers used to prevent unintended interactions between threads.

24
New cards

Linked List in Pthreads

A data structure that can be accessed by multiple threads which requires proper synchronization to prevent race conditions during Insert, Delete, and Member operations.