Threads and Processes Overview

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

1/42

flashcard set

Earn XP

Description and Tags

Flashcards to help review key concepts about processes and threads.

Last updated 1:28 AM on 3/30/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

43 Terms

1
New cards

What is a Process?

A process is an active execution of a program stored in memory.

2
New cards

When does a program become a process?

When it is loaded into memory.

3
New cards

What does a process's context include?

Information and data maintained for an executing program.

4
New cards

What is PID 0?

The swapper/scheduler process in the kernel responsible for memory management.

5
New cards

What is PID 1?

The init process responsible for starting up and shutting down the system.

6
New cards

What is the state of a process when it is initially created?

New.

7
New cards

What state is a process in when it is ready for execution?

Ready.

8
New cards

What is a context switch?

The process of switching the CPU from one process to another.

9
New cards

What happens during a context switch?

The OS saves the PCB of the old process and loads the PCB of the new process.

10
New cards

How long does a typical context switch take?

About 1 millisecond.

11
New cards

What are wait() and waitpid() system calls used for?

To force the parent process to suspend execution until the child process has completed.

12
New cards

What is multithreading?

Allowing multiple threads per process.

13
New cards

What are the benefits of multithreading?

Responsiveness, resource sharing, economy, scalability.

14
New cards

What does a thread represent?

A lightweight process associated with a particular process.

15
New cards

What is an independent stream of instructions in terms of operating systems?

A thread.

16
New cards

What do threads share within the same process?

Resources such as address space, variables, and files.

17
New cards

What is the pthreads library used for?

To create, manage, and synchronize threads on Linux.

18
New cards

What does pthread_create() do?

Creates a new thread.

19
New cards

What is the function of pthread_join()?

Wait for a specified thread to terminate.

20
New cards

What happens if a process issues an exit() system call?

All threads within that process are terminated.

21
New cards

What is pthread_exit() used for?

To terminate the calling thread without terminating the process.

22
New cards

What is memory sharing like between processes and threads?

Processes do not share memory; threads within the same process do.

23
New cards

What differentiates threads from processes regarding operation cost?

Threads have lower operational costs for communication due to shared memory.

24
New cards

What does the execution environment include for a process?

Files, memory space, and resources shared by threads.

25
New cards

How do changes in shared resources by one thread affect other threads?

All other threads will see changes made to shared resources.

26
New cards

What is a key consequence of threads sharing resources?

Requires explicit synchronization by the programmer.

27
New cards

What happens when a thread closes a file?

Other threads will also see that file as closed unless explicitly kept open.

28
New cards

What is the library call to detach a thread?

pthread_detach.

29
New cards

What is the result of failing to join or detach threads?

Memory and other resources will leak until the process ends.

30
New cards

How can you create a new thread?

By calling pthread_create with appropriate arguments.

31
New cards

What is the purpose of the 'arg' parameter in pthread_create?

To pass an argument to the function that the thread starts executing.

32
New cards

What does 'detaching a thread' mean?

System resources for the thread are reclaimed when it ends.

33
New cards

What is the major difference of context switching between threads versus processes?

Context switching between threads is less expensive compared to processes.

34
New cards

How is communication between threads achieved?

Through shared memory space.

35
New cards

What is the main advantage of using threads over processes?

Threads have lower overhead and faster context switching.

36
New cards

What does the 'exit status' parameter in pthread_exit() refer to?

The status passed to the pthread_join() function waiting for the thread.

37
New cards

What are the implications of two pointers pointing to the same data?

Changes in one thread can affect the data visible to other threads.

38
New cards

What library must be included to use pthreads?

.
39
New cards

What can the pthread_equal() function check?

It compares thread IDs.

40
New cards

What is the significance of context switches in terms of CPU utilization?

The system does no useful work while switching.

41
New cards

How can multithreading enhance system performance?

By minimizing response time and supporting concurrency.

42
New cards

What is the effect of one thread terminating in a process?

If the process terminates, all threads also terminate.

43
New cards

What resource types can threads share, which processes cannot?

Address space and file descriptors.

Explore top flashcards

flashcards
Skeletal system II / Joints
175
Updated 410d ago
0.0(0)
flashcards
Business Quiz #1
34
Updated 1104d ago
0.0(0)
flashcards
100 questions.
100
Updated 296d ago
0.0(0)
flashcards
Chapter 8
41
Updated 1029d ago
0.0(0)
flashcards
Hamlet (Acts III-V) 76 words
76
Updated 1236d ago
0.0(0)
flashcards
Year 3 EMIs
309
Updated 383d ago
0.0(0)
flashcards
Skeletal system II / Joints
175
Updated 410d ago
0.0(0)
flashcards
Business Quiz #1
34
Updated 1104d ago
0.0(0)
flashcards
100 questions.
100
Updated 296d ago
0.0(0)
flashcards
Chapter 8
41
Updated 1029d ago
0.0(0)
flashcards
Hamlet (Acts III-V) 76 words
76
Updated 1236d ago
0.0(0)
flashcards
Year 3 EMIs
309
Updated 383d ago
0.0(0)