Mod 1: Introduction Flashcards
What is concurrency?
(1) Concept of managing multiple tasks,
(2) Two or more things happening (seemingly) at the same time,
(3) Several tasks making progress, sharing CPU
What is a task?
Unit of a program
What is parallell programming?
(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)
With the support of which three is concurreny achieved?
(1) The underlying hardware
(2) The Operating system
(3) The application
What is a “scheduler”?
Program runned by the OS or Runtime, deciding which process should run within the next period of time
What is the purpose of a scheduler?
Decide which process should be allowed to run within the next period of time
What are the two types of scheduling?
(1) Preemptive
(2) Cooperative
What is preemptive sheduling?
> priority-based
gives every task exclusive access to a computing resource for a given time
common i multitasking OS
What is cooperative scheduling?
Mechanism that give every task exclusive access until the task is done, or let the computing resource go
What is an interrupt?
Signal to the processor produced by hardware or software indicating an event needing immediate attention
What does multitasking refer to?
It refers to
(1) the OS ability to run more than one process at the time,
(2) utilizing one or more CPU resources
Give an example of multitasking
Multithreading
multitasking within an application, executing several tasks concurrently
What is a process?
Application in execution
What does a process consists of?
(1) Program instructions
(2) Stack memory/Call Stack
(3) A heap memory
(4) Program counter (register)
(5) Other resources eg. security info
Does two different processes share memory space?
No
What is the relationship between a process , a thread and a task?
(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
How is concurrency accomplished on a single processor/core?
Time-slicing
What defines a concurrent application?
Application containing two or more processes (or threads) that work together to perform a task
What is the difference between a sequential application and a concurrent application?
A sequential application has one single thread of execution and a concurrent application has multiple threads of execution
How does communication between processes take place?
By using shared variables or message passing
What is “Parallelism”?
It refers to the ability to perform multiple tasks simultaneously
How can we achieve parallelism in an application?
By splitting the application into smaller tasks where they can be executed in parallel
What is the difference between concurrency and parallelism?
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.
Can parallelism be considered a form of concurrency?
Yes