Chapter 4 - Review Questions: Threads

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

1/21

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.

22 Terms

1
New cards

How many threads does a traditional, heavyweight process have?

A single thread of control

2
New cards

Provide at least three benefits of multithreaded programming.

1. Responsiveness

2. Resource sharing

3. Economy

*4. Scalability

3
New cards

True or False? Concurrency is only possible with parallelism.

False, it is possible to have concurrency without parallelism.

4
New cards

True or False? Amdahl's Law addresses the disproportionate effect of

the serial portion of a program.

True

5
New cards

List at least three challenges when designing programming for multicore

systems.

1. Identifying tasks

2. Balance

3. Data splitting

*4. Data dependency

*5. Testing and debugging

6
New cards

What are the two general types of parallelism?

1. Data parallelism

2. Task parallelism

7
New cards

List the three common ways of mapping user threads to kernel threads.

1. Many-to-one

2. One-to-one

3. Many-to-many

8
New cards

True or False? Only Linux and Windows implement the one-to-one

model.

True

9
New cards

What are the two approaches for implementing a thread library?

1. Provide the library in the user space with no kernel support.

2. Implement a kernel-level library supported directly by the operating system.

10
New cards

What are the three main thread libraries in use?

1. POSIX Pthreads

2. Windows

3. Java

11
New cards

True or False? PThreads is typically only implemented on UNIX-like

systems.

True

12
New cards

True or False? PThreads is only a specification, not an implementation.

True

13
New cards

What is the PThread API for creating a thread?

pthread_create()

14
New cards

What is the Windows API for creating a thread?

CreateThread()

15
New cards

What Java method is used for allocating and initializing a new thread in

the JVM?

start()

16
New cards

Provide at least two techniques for supporting implicit threading

1. Thread Pools

2. OpenMP

3. Grand Central Dispatch(GDP)

17
New cards

True or False? Grand Central Dispatch only works for Apple's Mac OS X

and iOS operating systems.

True

18
New cards

True or False? The semantics of the fork() system call can vary on

multithreaded systems.

True

19
New cards

What are the two scenarios for canceling a target thread?

1. Asynchronous Cancellation (One thread immediately terminates the target thread)

2. Deferred cancellation (The target thread periodically checks whether it should terminate)

20
New cards

What is the PThreads API for thread cancellation?

pthread_cancel()

21
New cards

True or False? Windows threads provide both user and kernel stacks.

True

22
New cards

What term does Linux use to refer to a process or a thread?

task