Computing/Operating System

06 - 07 > Thread [쓰레드, 멀티 쓰레딩]

i독 2021. 11. 7. 16:27

* 해당 게시물은 경북대학교 컴퓨터학부 강의초빙교수, 배준현 교수님의 강의를 보고 작성되었음을 미리 알려드립니다. ( 개인적인 공부를 정리한 글입니다. )

 

> 주니온 TV Youtube Channel. https://www.youtube.com/channel/UCOcPzXDWSrnaKXse9XOPiog

 

주니온TV 아무거나연구소

TMI Lab. 아무거나 연구소의 유튜브 TMI 지식나눔 채널 컴퓨팅 사고력을 키워 주고 코딩 지능을 길러 주는 자세히 보면 유익한 코딩 채널 주니온TV@Youtube 주니온 박사: 현) 경북대학교 컴퓨터학부 초

www.youtube.com

> 주니온 TV Inflearn page. https://www.inflearn.com/users/@joonion

 

주니온님의 소개 - 인프런 | 온라인 강의 플랫폼

인프런 지식공유자 주니온님의 소개 페이지 입니다. - 지식공유자 소개 | 인프런...

www.inflearn.com


[  ] A thread is

- a lightweight process.

- a basic unit of CPU utilization.

- comprises a thread ID(pid X), a program counter, a register set, and a stack.

굳이 fork 필요 없이, 프로그램 내에서 thread 관리할 있다.

 

Figure 4.1 Single-threaded and multithreaded processes.

 

[  ] The benefits of multithreaded programming:

- Responsiveness: may allow continued execution

  if part of process is blocked, especially important for user interfaces.

- Resource Sharing: threads share resources of process,

  easier than shared-memory or message-passing.

- Economy: cheaper than process creation,

  thread switching lower overhead than context switching.

- Scalability(확장성): proeess can take advantage of multiprocessor architectures

 

[  ] Multithreading in a multicore system.

- more efficient use of multiple cores for improved concurrency.

- There are four threads.

Figure 4.3 C o ncurrent execution on a single-core system.
Figure 4.4 Parallel execution on a multicore system.

 

[  ] Programming Challenges in Multicore systems.

- Identifying tasks: find areas can be divided into separate tasks.

확실하게 병렬적으로 수행해야만 하는 작업이 무엇인지를 결정하는 . 쪼개는 것이 무의미해질 있다.

- Balance: ensure the tasks to perform equal work of equal value.

- Data splitting: data also must be divided to run on separate cores.

- Data dependency: ensure that the execution of tasks is synchronized to

  accommodate the data dependency

- Testing and debugging: more difficult than single-thread.

 

[  ] Types of parallelism.

Figure 4.5 Data parall e lism and task parallelism.

분산시스템을 통해서 컴퓨터 환경을 구성한다면 위의 개념은 크게 중요하지 않다.

 

[  ] Amdahl's Law 코어는 무조건 많을수록 좋은가?

- for example,

  S = 0.25, N=2, speedup = 1.6

  S = 0.25, N=4, speedup = 2.28

모든 것이 병렬처리가 가능하다면, 선형적으로 속도가 증가하겠지만, 그렇지 못한다면 선형적인 결과를 기대할 수 없다.