Mod 1: Introduction Flashcards

1
Q

What is concurrency?

A

When two or more things seemingly happen at the same time

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

What is “currency programming”?

A

When you

(1) make to or more task seem to execute at the same time, and they
(2) share the computer’s CPU

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

What is a task?

A

Unit of a program that can be executed concurrently with other units of a program

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

What is parallell programming?

A

When two or more tasks run at the same time, NOT sharing the computer’s CPU

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

With the support of which three is concurreny achieved?

A

(1) The underlying hardware
(2) The Operating system
(3) The application

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

What is a “scheduler”?

A

Program runned by the OS or Runtime

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

What is the purpose of a scheduler?

A

Decide which process should be allowed to run within the next period of time

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

What are the two types of scheduling?

A

(1) Preemptive
(2) Cooperative

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

What is preemptive sheduling?

A

> priority-based
gives every task exclusive access to a computing resource
given time period

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

What is cooperative scheduling?

A

mechanism that give every task exclusive access until the task is done, or let the computing resource go

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

What is an interrupt?

A

Signal to the processor produced by hardware or software indicating an event needing immediate attention

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

What does multitasking refer to?

A

OS ability to quickly switch between computing task

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

Give an example of multitasking

A

Multithreading

multitasking within an application, executing several tasks concurrently

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

What is a process?

A

An instance of an application being executed

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

What does a process consists of?

A

(1) Program instructions
(2) Stack memory/Call Stack
(3) A heap memory
(4) Program counter (register)
(5) Other resources eg. security info

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

Does two different processes share memory space?

A

No

17
Q

What is the relationship between a process , a thread and a task?

A

(1) Both are units of execution
(2) A threads runs within the address space of process, whilst the process run in it’s on space isolated from other processes
(3) Every process has at least one thread
(4) Every thread performs a task
(5) A task is unit of work that is to be scheduled

18
Q

How is concurrency accomplished on a single processor/core?

A

Time-slicing

19
Q

What defines a concurrent application?

A

Application containing two or more processes (or threads) that work together to perform a task

20
Q

What is the difference between a sequential application and a concurrent application?

A

A sequential application has one single thread of execution and a concurrent application has multiple threads of execution

21
Q

How does communication between processes take place?

A

By using shared variables or message passing

22
Q

What is “Parallelism”?

A

It refers to the ability to perform multiple tasks simultaneously

23
Q

How can we achieve parallelism in an application?

A

By splitting the application into smaller tasks where they can be executed in parallel

24
Q

What is the difference between concurrency and parallelism?

A

Concurrency: running seemingly at the same time (eg. so short intervals it gives the illusion of running parallel)

Parallelism: running exactly at the same time (eg. two applications run purely parallel, each in a separate processor)

Parallelism can be considered as a form of concurrency.

25
Q

Can parallelism be considered a form of concurrency?

A

Yes

26
Q

What is multithreading about?

A

Using more than on thread in an application, executing at the same time within the process

27
Q

What is the main advantage of multithreading?

A

(1) Increased performance
(2) Increased responsiveness

28
Q

Explain why a thread is cheaper than a new process in context switching

A

Since threads share a process memory it is not required to reload memory maps, updating tables, lists eg. which results in it taking less CPU time and affects performance less negative

29
Q

What are some benefits of multithreading?

A

(1) Improved throughput
(2) Improved responsivenesss
(3) Performing complex computations

30
Q

What does “improved throughput” mean?

A

Eg. the processor will be idle waiting for IO operations taking time, one thread can take this job making better use of processor

31
Q

What does “improved responsiveness” mean?

A

eg. UI can be more responsive it certain parts (eg. IO calls) can be given to a thread

32
Q

What is the downside of multithreading?

A
  • Resource expensive as a large number of thread takes a lot of memory, and take a lot of CPU time
33
Q

How can concurrency be implemented?

A

(1) Processes
(2) Threads