Threads

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

1/93

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.

94 Terms

1
New cards
A ___________ is a basic unit of CPU utilization; it comprises a thread ID, a program counter (PC), a register set, and a stack.
thread
2
New cards
A thread shares with other threads belonging to the same process its ___________ section, ___________ section, and other operating-system resources, such as open files and signals.
code, data
3
New cards
A traditional process has a ___________ thread of control.
single
4
New cards
If a process has ___________ threads of control, it can perform more than one task at a time.
multiple
5
New cards
Most software applications that run on modern computers and mobile devices are ___________.
multithreaded
6
New cards
An application typically is implemented as a separate ___________ with several threads of control.
process
7
New cards
An application that creates photo ___________ from a collection of images may use a separate thread to generate a thumbnail from each separate image.
thumbnails
8
New cards
A web ___________ might have one thread display images or text while another thread retrieves data from the network.
browser
9
New cards
A word ___________ may have a thread for displaying graphics, another thread for responding to keystrokes from the user, and a third thread for performing spelling and grammar checking in the background.
processor
10
New cards
Applications can also be designed to leverage processing capabilities on ___________ systems.
multicore
11
New cards
Such applications can perform several ___________ tasks in parallel across the multiple computing cores.
CPU-intensive
12
New cards
In certain situations, a single application may be required to perform several ___________ tasks.
similar
13
New cards
For example, a web ___________ accepts client requests for web pages, images, sound, and so forth.
server
14
New cards
A busy web server may have several (perhaps thousands of) clients ___________ accessing it.
concurrently
15
New cards
If the web server ran as a traditional ___________ process, it would be able to service only one client at a time, and a client might have to wait a very long time for its request to be serviced.
single-threaded
16
New cards
One solution is to have the server run as a single ___________ that accepts requests.
process
17
New cards
When the server receives a request, it creates a separate ___________ to service that request.
process
18
New cards
In fact, this - method was in common use before threads became popular.
process-creation
19
New cards
Process creation is ___________ consuming and resource intensive, however.
time
20
New cards
If the new process will perform the same ___________ as the existing process, why incur all that overhead?
tasks
21
New cards
It is generally more ___________ to use one process that contains multiple threads.
efficient
22
New cards
If the web-server process is ___________, the server will create a separate thread that listens for client requests.
multithreaded
23
New cards
When a request is made, rather than creating another ___________, the server creates a new thread to service the request and resumes listening for additional requests.
process
24
New cards
Most operating system ___________ are also typically multithreaded.
kernels
25
New cards
As an example, during system boot time on Linux systems, several kernel threads are ___________.
created
26
New cards
Each thread performs a ___________ task, such as managing devices, memory management, or interrupt handling.
specific
27
New cards
The command ___________ can be used to display the kernel threads on a running Linux system.
ps -ef
28
New cards
Examining the output of this command will show the kernel thread ___________ (with pid = 2), which serves as the parent of all other kernel threads.
kthreadd
29
New cards
Many applications can also take advantage of ___________ threads, including basic sorting, trees, and graph algorithms.
multiple
30
New cards
In addition, programmers who must solve contemporary - problems in data mining, graphics, and artificial intelligence can leverage the power of modern multicore systems by designing solutions that run in parallel.
CPU-intensive
31
New cards
___________ an interactive application may allow a program to continue running even if part of it is blocked or is performing a lengthy operation, thereby increasing responsiveness to the user.
Multithreading
32
New cards
This quality is especially useful in designing ___________ ___________.
user interfaces
33
New cards
Processes can share resources only through techniques such as ___________ ___________ and message passing.
shared memory
34
New cards
However, threads share the ___________ and the resources of the process to which they belong by default.
memory
35
New cards
The benefit of sharing code and data is that it allows an application to have several different threads of activity within the same ___________ ___________.
address space
36
New cards
Allocating memory and resources for process creation is ___________.
costly
37
New cards
Because threads share the resources of the process to which they belong, it is more ___________ to create and context-switch threads.
economical
38
New cards
Empirically gauging the difference in ___________ can be difficult, but in general thread creation consumes less time and memory than process creation.
overhead
39
New cards
Additionally, ___________ ___________ is typically faster between threads than between processes.
context switching
40
New cards
The benefits of multithreading can be even greater in a ___________ architecture, where threads may be running in parallel on different processing cores.
multiprocessor
41
New cards
A ___________ process can run on only one processor, regardless how many are available.
single-threaded
42
New cards
Every process has ___________ or more threads, allowing the same process to perform multiple tasks concurrently.
one
43
New cards
Each thread executes ___________ of one another and therefore each thread requires its own stack.
independently
44
New cards
A ___________ process or program that has only one thread of control (and so executes on only one core at a time).
single-threaded
45
New cards
___________: A term describing a process or program with multiple threads of control, allowing multiple simultaneous execution points.
multithreaded
46
New cards
Earlier in the history of computer design, in response to the need for more computing performance, ___________-CPU systems evolved into multi-CPU systems.
single
47
New cards
A later, yet similar, trend in system design is to place multiple computing ___________ on a single processing chip where each core appears as a separate CPU to the operating system (Section Multiprocessor systems).
cores
48
New cards
We refer to such systems as ___________, and multithreaded programming provides a mechanism for more efficient use of these multiple computing cores and improved concurrency.
multicore
49
New cards
On a system with a single computing core, ___________ merely means that the execution of the threads will be interleaved over time (animation titled Concurrent execution on a single-core system), because the processing core is capable of executing only one thread at a time.
concurrency
50
New cards
On a system with multiple cores, however, concurrency means that some threads can run in ___________, because the system can assign a separate thread to each core (animation titled Parallel execution on a dual-core system).
parallel
51
New cards
___________ means all threads make progress on a single-core system as each thread gets to run for a short period of time on the single processing core.
Concurrency
52
New cards
___________ allows two threads to run at the same time as each thread runs on a separate processing core.
Parallelism
53
New cards
Notice the distinction between ___________ and parallelism in this discussion.
concurrency
54
New cards
A ___________ system supports more than one task by allowing all the tasks to make progress.
concurrent
55
New cards
In contrast, a ___________ system can perform more than one task simultaneously.
parallel
56
New cards
Thus, it is possible to have ___________ without parallelism.
concurrency
57
New cards
Before the advent of ___________ and multicore architectures, most computer systems had only a single processor, and CPU schedulers were designed to provide the illusion of parallelism by rapidly switching between processes, thereby allowing each process to make progress.
multiprocessor
58
New cards
Such processes were running ___________, but not in parallel.
concurrently
59
New cards
The trend toward multicore systems continues to place pressure on system designers and application programmers to make better use of the multiple computing ___________.
cores
60
New cards
Designers of operating systems must write ___________ ___________ that use multiple processing cores to allow the parallel execution shown in the animation titled Parallel execution on a dual-core system.
scheduling algorithms
61
New cards
For application programmers, the challenge is to modify existing programs as well as design new programs that are ___________.
multithreaded
62
New cards
This involves examining applications to find areas that can be divided into separate, ___________ tasks.
concurrent
63
New cards
Ideally, tasks are ___________ of one another and thus can run in parallel on individual cores.
independent
64
New cards
While identifying tasks that can run in parallel, programmers must also ensure that the tasks perform ___________ work of equal value.
equal
65
New cards
Just as applications are divided into separate tasks, the ___________ accessed and manipulated by the tasks must be divided to run on separate cores.
data
66
New cards
The data accessed by the tasks must be examined for ___________ between two or more tasks.
dependencies
67
New cards
When one task depends on data from another, programmers must ensure that the ___________ of the tasks is synchronized to accommodate the data dependency.
execution
68
New cards
When a program is running in parallel on multiple cores, many different ___________ paths are possible.
execution
69
New cards
___________ and debugging such concurrent programs is inherently more difficult than testing and debugging single-threaded applications.
Testing
70
New cards
Amdahl's Law is a ___________ that identifies potential performance gains from adding additional computing cores to an application that has both serial (nonparallel) and parallel components.
formula
71
New cards
If S is the portion of the application that must be performed ___________ on a system with N processing cores, the formula appears as follows: speedup≤S+N(1−S)​1​
serially
72
New cards
The ___________ portion of an application can have a disproportionate effect on the performance we gain by adding additional computing cores.
serial
73
New cards
In general, there are two types of parallelism: data parallelism and ___________ parallelism.
task
74
New cards
___________ parallelism focuses on distributing subsets of the same data across multiple computing cores and performing the same operation on each core.
Data
75
New cards
___________ parallelism involves distributing not data but tasks (threads) across multiple computing cores.
Task
76
New cards
Each thread is performing a ___________ operation.
unique
77
New cards
Fundamentally, then, data parallelism involves the ___________ of data across multiple cores, and task parallelism involves the distribution of tasks across multiple cores, as shown in Figure 4.2.1.
distribution
78
New cards
A ___________ system allows more than one task to run simultaneously.
parallel
79
New cards
___________ involves distributing tasks across multiple computing cores.
Task parallelism
80
New cards
___________: Multiple processing cores within the same CPU chip or within a single system.
multicore
81
New cards
___________: A computing method that distributes subsets of the same data across multiple cores and performs the same operation on each core.
data parallelism
82
New cards
___________: A computing method that distributes tasks (threads) across multiple computing cores, with each task is performing a unique operation.
task parallelism
83
New cards
Support for threads may be provided either at the ___________ level, for user threads, or by the kernel, for kernel threads.
user
84
New cards
___________ threads are supported above the kernel and are managed without kernel support, whereas kernel threads are supported and managed directly by the operating system.
User
85
New cards
Virtually all contemporary operating systems—including ___________, ___________, and macOS—support kernel threads.
Windows, Linux
86
New cards
The -to- model maps many user-level threads to one kernel thread.
many-to-one
87
New cards
Thread management is done by the thread ___________ in user space, so it is efficient (we discuss thread libraries in Section 4.4).
library
88
New cards
However, the entire process will ___________ if a thread makes a blocking system call.
block
89
New cards
Also, because only one thread can access the kernel at a time, multiple threads are unable to run in ___________ on multicore systems.
parallel
90
New cards
___________ threads—a thread library available for Solaris systems and adopted in early versions of Java—used the many-to-one model.
Green
91
New cards
The -to- model maps each user thread to a kernel thread.
one-to-one
92
New cards
It provides more ___________ than the many-to-one model by allowing another thread to run when a thread makes a blocking system call.
concurrency
93
New cards
It also allows multiple threads to run in parallel on ___________.
multiprocessors
94
New cards
The only drawback to this model is that creating a user thread requires creating the corresponding ___________ thread, and a large number of kernel threads may burden the performance of a system.
kernel