Lecture 9

SFR1811·2022년 1월 28일
0

5 Concurrency

  • Thread
    • independent sequential execution path through a program
    • 'a conceptual dot' that navigates through you code!
  • Process
    • a program component (like a routine) that has its own threads and has the same state information as a coroutine - i.e. it has it's own stack.
  • Task
    • a reduced process
    • often process has it's own memory, while task share a common memory

process vs task has some gray area

Parallel execution means 2 or more operations occur simultaneously
i.e. you need multiple processors to be parallel.
i.e. multiple thread doesn't mean parallel if it is on single CPU.

Concurrent execution is any situation in which execution of multiple threads appears to be performed in parallel.
i.e. if you have multiple threads running at the same time, you have concurrency


5.1 Why Write Concurrent Programs?

Goal is to modulize program to multiple processes/tasks so that we can run it under multiple CPU and perform it faster!

Communication between threads is expensive. It is essential though, so it has to be short and condenced as possible.

It is all about dealing with non-deterministic behaviors.

5.5 Threading Model

profile
3B CS

0개의 댓글