College Board Video Questions

AP Classroom. Provide answers and thoughts on theoritical question form college board Video in section 4.

Example #1

A particular computer has two identical porcessors which can run in parallel. Each process must be executed on a single processor and each processor can only run one process at a time.

The table below lists the amount of time it takes to execute each of the processes on a single computer. None of the processes are dependent on any of the others.

What is the minimum amount of tim (approxinmate) to execute all three processes when the two processors are run in parallel.

Process Execution Time on Either Processor
X 50 seconds
Y 10 seconds
Z 30 seconds

Answer: 50 seconds

X and Y start their processes first, once the Y is finished the Z will go next. Once all proceses are done 50 seconds would have passed.

Example #2

A computer has two duplicate processors that are able to run in parallel. The table below shows the amount of time it takes each processor to execute each of two processes. Neither process is dependent on the other.

What id the difference in execution time between running the two processes in parallel in place of running the one after the other on a single processor?

Process Execution Time on Either Processor
A 25 seconds
B 45 seconds

Answer: Running the two processes one after another, 25 + 45 = 70 seconds. Running both in parallel will yield a minimum time of 45 seconds. 70 - 45 = 25 seconds.

Parallel running means that that it will run 45 seconds. One after another means 70 seconds. The difference between those times is 25 seconds.

Example #3

A computer has two processors that can run in parallel. The table below indicates the amount of time it takes each processor to execute four different processes. None of the processes is dependent on any of the other processes.

Describe how the program should assign the four processes to optimize execution time?

Process Execution Time
A 25 seconds
B 25 seconds
C 10 seconds
D 40 seconds

Answer: Processes A and B should be assigned to one processor and C and D to the other processor.

Build a List Comprehension Example

numbers = [1, 2, 3, 4, 5]
#making a new list with the squares of the numbers
#LIST COMP!!!
#iterate over old list and applying square to each element
squares = [x**2 for x in numbers]
#printing the final list
print(squares)
[1, 4, 9, 16, 25]