Mod 1: Introduction Flashcards

1
Q

What is concurrency?

A

(1) Concept of managing multiple tasks,
(2) Two or more things happening (seemingly) at the same time,
(3) Several tasks making progress, sharing CPU

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

What is a task?

A

Unit of a program

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

What is parallell programming?

A

(1) When two or more tasks run at the same time (actually, not seemingly),
(2) NOT sharing the computer’s CPU,
(3) Requires at least two cores in the CPU (if only one)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
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
5
Q

What is a “scheduler”?

A

Program runned by the OS or Runtime, deciding which process should run within the next period of time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
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
7
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
8
Q

What is preemptive sheduling?

A

> priority-based
gives every task exclusive access to a computing resource for a given time
common i multitasking OS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
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
10
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
11
Q

What does multitasking refer to?

A

It refers to

(1) the OS ability to run more than one process at the time,
(2) utilizing one or more CPU resources

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
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
13
Q

What is a process?

A

Application in execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
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
15
Q

Does two different processes share memory space?

A

No

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
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

17
Q

How is concurrency accomplished on a single processor/core?

A

Time-slicing

18
Q

What defines a concurrent application?

A

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

19
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

20
Q

How does communication between processes take place?

A

By using shared variables or message passing

21
Q

What is “Parallelism”?

A

It refers to the ability to perform multiple tasks simultaneously

22
Q

How can we achieve parallelism in an application?

A

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

23
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.

24
Q

Can parallelism be considered a form of concurrency?

A

Yes

25
Q

What is multithreading about?

A

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

26
Q

What is the main advantage of multithreading?

A

(1) Increased performance
(2) Increased responsiveness

27
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

28
Q

What are some benefits of multithreading?

A

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

29
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

30
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

31
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
32
Q

How can concurrency be implemented?

A

(1) Processes
(2) Threads