Lecture 10

SFR1811·2022년 2월 4일
0

5.7 Speedup

Primary reason for doing concurrency is to implement parallelism to speed up the process

Because of the communication and syncronization steps, usually there is no independent concurrency.
i.e. all threads start at once, then end at once.


5.8.3 Thread Object

_Task T{            // thread type
  void main(){...}  // thread starts here
};

int main(){
  {         // COBEGIN  In the destructor of T
    T t;    //          the main thread checks if t is still running
  }         // COEND    and if it is, it waits in the destructor
  
  // can be also written like this :/
  T *t = new T;  // create thread object on heap, start thread
  delete t;      // waits for thread to finish
}

5.8.4 Actor

based on message passing.

profile
3B CS

0개의 댓글