Computer Science/OS

4강. 연습문제

박붕어 2023. 11. 27. 01:59

4강. 연습문제

4.1 Provide two programming examples in which Multithreading does not provide better performance than a single-threaded solution.

(1) Sequential Program은 Multithread에 불리하다. 순차 계산 프로그램 . ex. 개인 세금 계산 프로그램.

(2) 환경변수, 작업 디렉토리, 파일을 계속 monitor 해야하는 프로그램. ex. C-shell, korn shell

4.3 Which of the following components of program state are shared a cross threads in a multithread process?

a. Register Values

b. Heap Memory

c. Global Variables

d. Stack Memory

Heap Memory와 Global Variables는 Thread 간에 공유되고 Register Values와 Stack Memory는 Thread별로 나뉜다.

4.4 Can a Multithreaded solution using multiple user-level threads achieve better performance on a multiprocessor system than on a single-processor system?

Processor는 Kernel-level의 Thread와 Process만 작업을 한다. Process의 갯수가 달라져도 Processor에 할당될 수 있는 Kernel-level Thread가 없어 성능상의 이득이 없다.

4.6 Consider a multiprocessor system a multithreaded program written using the many to many threading model. Let the number of user-level threads in the program be more than the number of processors in the system. Discuss the performance implications of following senarios.

a. The number of kernel threads allocated to the program is less than the number of processors.

Processor는 Kernel-level Thread에 Mapping된 User-level Thread만 처리가 가능하다. 여러개의 Processor를 쓰지 못해 비효율적이다.

b. The number of kernel threads allocated to the program is equal to the number of processors.

Kernel-level Thread와 Processor가 1:1로 Mapping된다. Block된 Thread를 처리할 수 없다.

c. The number of kernel threads allocated to the program is greater than the number of processors but than the number of user-level threads.

모든 Processor가 잘 작동하고, Block을 해결할 수 있다.

'Computer Science > OS' 카테고리의 다른 글

CPU Scheduling (2)  (1) 2023.11.28
CPU Scheduling (1)  (0) 2023.11.27
Threads  (1) 2023.11.25
3강 연습문제  (2) 2023.11.25
Processes(2)  (2) 2023.11.24