Quiz questions Flashcards

1
Q

Threads vs Processes – select all that apply:

A

a. Threads can easily share memory, although this can lead to complications when using thread programming.

c. Processes have their own private memory and are isolated.

d. Threads are owned by processes. Every process must have at least one thread.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The operating system is responsible for the order threads are scheduled to execute.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Main bottleneck of most programs is:

A

b. Accessing memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Moore’s Law tells us several important things about computing.

A

b. In 1965, Gordon Moore predicted that the number of components on an integrated circuit would double every year or so.

f. Many have predicted the end of Moore’s law, although major chip manufacturers continue to see its effects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Select all answers that are true about the cache.

A

a. More expensive

c. Temporary storage

d. Fast memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the motivations for creating concurrent programs? Select all that apply.

A

a. Concurrent programs are better at sharing resources than sequential programs.

d. Concurrent programs are more responsive than sequential programs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Non coherent cache is when one processor makes a change to a shared memory value, but the other processors are not aware of the change.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Select all statements that are true about inheritance:

A

c. The “is a” relationship occurs when one class inherits from another.

d. Multiple inheritance has a variety of problems, Java does not allow it but instead provides “workarounds”.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A critical section of code is:

A

b. An area of the code that is shared by multiple threads and one thread is writing to that location

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Symmetric Multiprocessors (SMPs) use a shared memory design.

A

b. SMPs are easier to program than other processor designs in part because they use shared memory.

d. Memory sharing means that all processors can see the same block of memory, this is implemented by hardware in SMPs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Graphical Processing Units (aka GPUs) originally designed for games now have a variety of other uses.

A

a. A GPU is able to execute thousands of simple repetitive tasks in parallel, it accomplishes this with 100s of very simple processing units, sometimes referred to as a SIMD or Vector processor.

d. GPUs are often implemented with their own dedicated on board memory. 8GB is typical in 2024, although some have much more memory than this.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The benefits of using the interface, Runnable, over extends Thread in Java are: (Select all that apply)

A

a. Can implement many interfaces

c. Only requires one method to be implemented (run)

d. Allows for shared memory between threads

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If you leave out the join method in a program that creates threads, the program will never finish executing.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Select 2 reasons why a thread may be in a waiting state.

A

a. Waiting for input

c. Waiting for data from memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which of the following is not a state in the Thread state enumeration in Java.

A

d. Running

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Logical Cores vs. Physical Cores, select all that apply

A

b. A Physical Core may have one or more logical cores.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Data races and cache coherency are…

A

c. Two similar problems that can be solved in some cases with a synchronized method.

d. Both problems which if not handled properly can lead to incorrect results.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Semaphores can be used to communicate between threads. This is useful because…

A

a. … there are several synchronization problems that requires threads to be coordinated. A single thread can thus lead, or signal other threads that it is their turn.

d. … there are several synchronization problems that requires threads to be coordinated. A pair of threads can pass a signal back and forth, forcing serialization.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Select which of the following are atomic types in Java. (Select all that apply)

A

b. AtomicInteger

c. AtomicBoolean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

ReentrantLocks are more general than some primitives and less general than other primitives. Select true examples in the following cases:

A

a. Atomic Integers can be manually implemented with Reentrant Locks.

c. Anything that can be done with a synchronized method can be done with a ReentrantLock.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

The 2nd Assignment suggests that you use CyclicBarriers, identify some true statements about them:

A

a. A CyclicBarrier allows multiple threads to synchronize, meaning that they can block until each thread reaches the same line in the code.

d. A CyclicBarrier, as the name implies, can repeat its action over several trials.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

When a thread tries to obtain a lock on a Reentrant Lock and is unsuccessful, it is put back into the Runnable state to do other work.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

ReentrantLock class in Java provides the following method to protect a critical section. Select all that apply.

A

a. lock

b. unlock

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

The Readers and Writers problem …

A

b. … is a common problem encountered by databases, and if solved correctly, will allow multiple readers to concurrently access the database

c. … is a common problem encountered by databases, which for example are searched more frequently than they are updated.

e. … occurs when you have several readers and only one writer. A special lock mechanism is provided for this unusual case.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

Regarding the last instructions sent to a Thread Pool…

A

d. We had some difficulty demonstrating awaitTermination() in class, this method is suppose to do something like the .join() method for regular threads.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Select all the reasons why we would not want to have unbounded thread creation in an application.

A

a. Overhead of thread creation

c. Resource Consumption

d. Program Stability

27
Q

Regarding the size of the thread pool:

A

d. Thread pool size is problem dependent. If you don’t entirely understand your problem, setting the thread pool size equal to the number of virtual processors is reasonable.

28
Q

When the producer thread is finished executing (terminates), the consumer threads automatically exit as well.

A

False

29
Q

The producer / consumer problem and the Thread Pool problem share some characteristics, but have a few differences. Identify the connections between these two techniques.

A

c. The consumer / producer problem is a generic idea, for which several Java libraries provide tools that allow it to be implemented. ThreadPools have a direct implementation via the executor service.

d. Actually the techniques have quite a bit of overlap. Both define collections of jobs, and a way to process those jobs.

e. Abstractly both designs require a queue, and in principal the classes used to solve the consumer producer problem might be used to implement thread pools.

30
Q

The shutdown method for an Executor Service immediately shuts down all threads, stopping all work.

A

False

31
Q

The remove method for a BlockedQueue in Java will

A

b. throw an exception

32
Q

Thread pools are typically used for a certain kind of program:

A

c. A web server is a good example of a program that might make use of thread pools. The main thread would wait for connections and farm out the small jobs of serving pages to satisfy individual client requests.

d. The threads available in the pool typically handle short jobs. This saves overhead because you don’t need to create a new thread for each task.

33
Q

The number of poison objects inserted into the queue is…

A

b. equal to the number of consumer threads

34
Q

The VGA video standard …

A

a. was introduced by IBM in 1987 and supported 640 x 480 pixels in 16 colors.

35
Q

The following video standards have been in use within the last 20 years - select all that are true:

A

a. DVI-D

c. VGA

f. HDMI

36
Q

What is the resolution and color depth of the video standard mentioned?

A

720 x 480 pixels in 32 colors.

37
Q

When was the modern video standard that supports .gif files available?

A

It wasn’t available until the rise of the Internet and .gif files in 1995.

38
Q

How does the video standard mentioned compare to its predecessors EGA and CGA?

A

It was inferior to its predecessors, EGA and CGA.

39
Q

Which video standards have been in use within the last 20 years? (Select all that are true)

A

DVI-D, VGA, HDMI.

40
Q

What is the time complexity of a simple implementation of matrix multiply?

A

O(n^3) time.

41
Q

What is the time complexity of an optimal implementation of matrix multiply?

A

O(n * log n) time.

42
Q

What is the worst-case time complexity for matrix multiply?

A

Exponential time, i.e. O(3^n).

43
Q

What is the time complexity of the Strassen algorithm for matrix multiply?

A

O(n ^ 2.8)

44
Q

What is the time complexity of the Gauss algorithm for matrix multiply?

A

O(n ^ 2.3)

45
Q

What are cathode ray tubes (CRTs) built to support?

A

Resolutions limited to 1024x768.

46
Q

What special properties do CRTs have?

A

They have some special properties that cannot be reproduced by any other technology.

47
Q

How do CRTs render colors?

A

They trace an image on a phosphorescent screen, synchronized by a computer’s output, rendering colors with R, G, and B signals.

48
Q

What limitation did CRTs have regarding computer graphics?

A

They were not capable of displaying computer graphics at resolutions higher than 320x200 pixels.

49
Q

What is a frame buffer?

A

A portion of a computer’s memory that represents the pixels on a video display.

50
Q

Why was the frame buffer an issue for early computers?

A

Many early computers didn’t have enough memory to store an entire pixel map.

51
Q

What happens to the speedup ratio for small matrix sizes in parallel matrix multiply?

A

It has a speedup < 1 for small matrix sizes, usually if the matrix is smaller than 100x100.

52
Q

What is the dependency of single CPU matrix multiply on problem size?

A

It is highly dependent on the problem size due to caching effects.

53
Q

What does the Future interface allow us to do?

A

It is used to retrieve a result from a thread.

54
Q

What mechanism does the Future interface provide?

A

It builds on the idea of the producer/consumer.

55
Q

Examples of geometric shapes that exhibit affine self-similarity?

A

Koch snowflake, Sierpinski triangle.

56
Q

When the speed up ratio is less than 1, what does it mean?

A

It means we should not pick the parallel execution implementation as being faster.

57
Q

What is the overall theoretical speed up if a program needs 15 hours to complete with 3 hours that cannot be parallelized using 8 processors?

A

3.33

58
Q

Who invented fractals?

A

None of these answers are true.

59
Q

What is throughput defined as?

A

The number of tasks completed in a given amount of time.

60
Q

What is the maximum speedup possible with 3 hours of a 15-hour program that cannot be parallelized?

A

5

61
Q

What will be the maximum efficiency of a parallel program that runs on a machine with 32 processors?

A

0.138

62
Q

Which of the following equations are correct?

A

(2 + i) ^ 2 = 3 + 4i, i * i + 1 = 0.

63
Q

What is Amdahl’s Law used for?

A

It is used to predict the speedup that could be achieved by parallelizing the program.

64
Q

What can be used to test for liveness and performance of a parallel system?

A

Latency, Throughput, Speedup.