05. Process 2

CS STUDY/OS
2023.08.24

1. Thread

 

"A thread(or lightweight process) is a basic unit of CPU utilization"

 

  • Thread의 구성

        * program counter

        * register set

        * stack space

 

  • Thread가 동료 thread와 공유하는 부분(=task)

        * code section

        * data section

        * OS resources

 

        * 전통적인 개념의 heavyweight process는 하나의 thread를 가지고 있는 task로 볼 수 있다.

        * 다중 스레드로 구성된 태스크 구조에서는 하나의 서버 스레드가 blocked(waiting) 상태인 동안에도 동일한 태스크 내의 다른 스레드가 실행(running)되어 빠른 처리를 할 수 있다.

        *동일한 일을 수행하는 다중 스레드가 협력하여 높은 처리율(throughput)과 성능 향상을 얻을 수 있다.

        * 스레드를 사용하면 병렬성을 높일 수 있다.

 

  • single and Multithreaed Processes

  • Benefits of Threads

        * Responsiveness

                eg) multi-threaded Web - if one thread is blocked(eg network), another thread continues(eg display)

 

        * Resource Sharing

                * n threads can share binary code, data, resource of the process

 

        * Economy

                * creating&CPU switching thread(rather than a process)

                * Solaris의 경우 위 두 가지 overhead가 각각 30배, 5배

 

        * Utilization of MP Architectures

                * each thread may be running in parallel on a different processor

 

  • Implementation of Threads

        * some are supported by kernel -> Kernel Threads

                : 쓰레드가 여러개라는 것을 커널이 알고 있음. 그래서 커널이 스케줄링하듯이 넘겨줌.

                * Windows 95/98/NT

                * Solaris

                * Digital UNIX, Mach

 

        * Others are supported by library -> User Threads

                : 라이브러리가 전담하여 사용자 수준에서 스스로 쓰레드를 관리, 운영체제는 모름 -> 제약점이 있을 수 있음.

                * POSIZ Pthreads

                * Mach C-threads

                * Solaris threads

 

        * Some are real-time threads

 

 

'CS STUDY > OS' 카테고리의 다른 글

07. Process Management 2  (0) 2023.08.26
06. Process Management 1  (0) 2023.08.25
04. Process 1  (3) 2023.08.23
03. System Structure&Program Execution  (0) 2023.08.22
02. System Structure & Program Execution  (0) 2023.08.21