Homework assignment 4 (based on chapters 4 and 5)

Homework assignment 4 (based on chapters 4 and 5)

Chapter 4 Q&A

1. Which of the following items are shared across multiple threads belonging to the same

process?

A) code, data, files

B) registers

C) stack

D) all of the above

Ans: A

2. In a multithreaded server architecture, which of the following is used to service a new user

request?

A) a new created thread

B) a new created process

C) the same process for prior users

D) none of the above

Ans: A

3. Which of the following benefits go to multithreaded programming?

A) responsiveness

B) resource sharing

C) economy

D) scalability

E) all of the above

Ans: E

4. Which of the following refers to the capability to allow multiple tasks make progress on a

single processor system?

A) concurrency

B) parallelism

C) data parallelism

D) task parallelism

Ans: A

5. ___________ is a formula that identifies potential performance gains from adding additional

computing cores to an application that has a parallel and serial component.

1

A) Task parallelism

B) Data parallelism

C) Data splitting

D) Amdahl's Law

Ans: D

6. _____ is not considered a challenge when designing applications for multicore systems.

A) Deciding which activities can be run in parallel

B) Ensuring there is a sufficient number of cores

C) Determining if data can be separated so that it is accessed on separate cores

D) Identifying data dependencies between tasks.

Ans: B

7. Which of the following models are possible for the relationship between the user threads and

kernel threads?

A) many-to-one model

B) one-to-one model

C) many-to-many model

D) two-level model

E) all of the above

Ans: E

8. ____ is a thread library for Solaris that maps many user-level threads to one kernel thread.

A) Pthreads

B) Green threads

C) Sthreads

D) Java threads

2

Ans: B

9. The _____ model maps each user-level thread to one kernel thread.

A) many-to-many

B) two-level

C) one-to-one

D) many-to-one

Ans: C

10. The _____ model multiplexes many user-level threads to a smaller or equal number of kernel

threads.

A) many-to-many

B) two-level

C) one-to-one

D) many-to-one

Ans: A

11. Which of the following is a function that can be provided by Pthreads API for constructing a

multithreaded program?

A) pthread attr init

B) pthread_create

C) pthread_join

D) all of the above

Ans: D

12. In Pthreads, a parent uses the pthread_join() function to wait for its child thread to complete.

What is the equivalent function in WinAPI?

A) win32_join()

B) wait()

C) WaitForSingleObject()

3

D) join()

Ans: C

13. Which of the following statements regarding threads is false?

A) Sharing is automatically provided in Java threads.

B) Both Pthreads and WinAPI threads share global data.

C) The start() method actually creates a thread in the Java virtual machine.

D) The Java method join() provides similar functionality as the WaitForSingleObject in Win32.

Ans: A

14. The most common technique for writing multithreaded Java programs is _____.

A) extending the Thread class and overriding the run() method

B) implementing the Runnable interface and defining its run() method

C) designing your own Thread class

D) using the CreateThread() function

Ans: B

15. Which of the following is a method for implicit threading?

A) thread pools

B) OpenMP

C) all of the above

Ans: C

16. Which of the following options exist to deliver signals in multithreaded program?

A) deliver the signal to the thread to which the signal applies

B) deliver the signal to every thread in the process

C) deliver the signal to certain threads in the process

D) assign a specific thread to receive all signals for the process

E) all of the above

Ans: E

17. Which of the following options to deliver signals in multithreaded program should be applied

to an asynchronous signal that terminates a process (, for example)?

A) deliver the signal to the thread to which the signal applies

B) deliver the signal to every thread in the process

4

C) deliver the signal to certain threads in the process

D) assign a specific thread to receive all signals for the process

E) all of the above

Ans: B

18. Which of the following options to deliver signals in multithreaded program should be applied

to a synchronous signal?

A) deliver the signal to the thread to which the signal applies

B) deliver the signal to every thread in the process

C) deliver the signal to certain threads in the process

D) assign a specific thread to receive all signals for the process

E) all of the above

Ans: A

19. To associate each thread created using an implicit technique such as a thread pool, with its

unique transaction identifier, we could use ____?

A) global variable

B) local variable

C) static data

D) thread-local storage

Ans: D

20. LWP is ____.

A) short for lightweight processor

B) placed between system and kernel threads

C) placed between user and kernel threads

D) common in systems implementing one-to-one multithreading models

Ans: C

5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download