Lecture 9: Concurrency Flashcards

1
Q

What is concurrency?

A

It describes events that are happening at the same time. In coding it allows pieces of code to run with the illusion simultaneously.

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

What is Parallelism?

A

It is when we execute tasks at the same time for greater performance but it means that we need multiple cores.

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

Is parallel execution the only way to run events concurrently?

A

No, we can run them sequentially as long as the execution time is such that the user or environment can not tell the difference.

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

Why is it fine to run multiple tasks on one core?

A

Because most processors don’t need the CPU 100% of the time, and the processor is generally not a full load.

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

What is the problem with running functions sequentially?

A

We can variable execution times for the functions meaning we may get errors in output because things are not happening when they are meant to.

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

What can we do instead of sequential execution?

A

Use interleaved execution. This means that we run the code in a different order, making use of interrupts. It comes at a much greater overhead but reduces the run time.

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

What is asynchronous composition?

A

There is no blocking or waiting time between tasks which helps parallel execution. Tasks are able to execute at their own tasks regardless of the main loop. We can’t determine the relationship between tasks.

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

What is synchronous composition?

A

Task will block any other processes until it reaches a synchronisation point. We can only parallel execute within a step. We are able to determine the relationships between tasks.

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

How do we achieve asynchronous composition?

A

Having multiple cores allows tasks to run at their own pace. Interrupts will execute at a pace seperate to other interrupts or the main function. Therefore during compile time we are unable to tell when the ISR’s will execute.

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

How many states are there when combining two asynchronous states>?

A

Simply multiply the number of states of one machine with the number of states of the other?

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

How many states are there when combining two synchronous states?

A

It is the same as Asynchronous but if we have equivalent transitions then we get less states.

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

What is the difference between a function and a real time operating system task?

A

A RTOS task will have its variables set to global, therefore the data is saved when task switch occurs. A function will lose its data unless it has global variables.
RTOS tasks can be reused to create multiple of the same task whereas we can’t reuse a function unless we pass in different inputs.

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

What is a simple schedule?

A

It is a cyclic executive where each task is executed in order in the main loop until it gives up the processor. WE don’t want any tasks to be blocking. Each time a task is invoked it will execute part of a task.

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

What is the WCRT of a simple schedule?

A

It is the time taken to get back to the start of a cycle.

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

Can we consider a simple schedule to be concurrent?

A

Yes as long as the WCRT is faster than the arrival of events.

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

What is a timer cyclic executive?

A

It uses Timer ISR’s to ensure that there is a fixed cycle period. It means that the WCRT must be less than the timer overflow