Computer Science/OS

3강 연습문제

박붕어 2023. 11. 25. 02:18

3.1 Describe the differences among short-term, medium-term, and long-term scheduling

  • Short-term Scheduler : Ready Queue에서 Process를 선택하여 CPU에 할당하는 작업을 한다. 아주 빠르고, 자주 일어난다. (frequently, fast)
  • Long-term Scheduler : Job Queue에서 Process를 선택해 Ready Queue로 옮긴다. Degree of Multiprogramming을 Control하는 놈이다. Main Memory에 올라가는 Process의 갯수를 조절하여 degree를 조절한다.
  • Midium-term Scheduler : Swapping을 담당한다. Event를 기다리는 Wait 상태의 Process를 Memory에서 Disk로 Swap out한다. Degree of Multiprogramming을 줄이는 놈이다.

3.2 Describe the actions taken by a kernel to context-switch between process.

  1. CPU에서 실행중인 Process P1의 정보를 PCB1에 저장한다.
  2. 다음 CPU에서 실행할 Process를 Scheduling한다.
  3. 결정된 Process의 정보를 PCB로부터 불러온다.

3.4 What are the benefits and the disadvantages of each of the following? Consider both the system level and the programmer level.

a. Synchronous and Asynchronous Communication

  • Synchronous Communication : Block 방식
    • 장점 : Producer가 보내려는 Message가 정확한 Consumer에게 전달된다.
    • 단점 : Consumer나 Producer가 Block되어 오래기다릴 수 있다.
  • Asynchronous Communication : Non-Block방식
    • 장점 : Consumer와 Producer가 기다리지 않는다.
    • 단점 : Message가 의도한 수신자가 아닌 다른 수신자에게 전달될 수 있다.

b. Automatic and Explicit Buffering

  • Automatic Buffering
    • 장점 : Sender가 Block될 일이 없다.
    • 단점 : Message가 Memory의 크기를 넘어가면 Message가 유실될 수 있다.
  • Explicit Buffering
    • 장점 : Message가 유실되지 않는다.
    • 단점 : 버퍼가 가득차면 Sender는 버퍼에 공간이 생길때 까지 Block된다.

c. Send by copy and Send by reference

  • Send by copy : 전달하려는 값을 복사하여 전달.
    • 장점 : Sender나 Receiver중 한 명이 값을 수정해도 다른 한명에게 영향을 미치지 않는다. → 안전하다.
    • 단점 : Receiver가 값을 수정할 수 없다. 전달하려는 값이 크면 복사하는 비용이 많이 소모된다.
  • Send by reference : 전달하려는 값의 메모리 주소를 전달.
    • 장점 : Receiver가 값을 변경할 수 있다. 잔달하려는 값의 크기에 상관없이 효율적으로 전달가능.
    • 단점 : Receiver의 의도치 않은 변경에 Sender가 영향을 받을 수 있다.

d. Fixed-Sized and Variable-Sized Message

  • Fixed-Sized Message
    • 장점 : System Level의 구현이 쉽다.
    • 단점 : Capacity가 고정되어 있다.
  • Variable-Sized Message
    • 장점 : Capacity가 고정되어 있지 않다.
    • 단점 : 구현이 어렵다.

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

4강. 연습문제  (1) 2023.11.27
Threads  (1) 2023.11.25
Processes(2)  (2) 2023.11.24
Processes(1)  (0) 2023.11.24
운영체제 2강 연습문제  (0) 2023.11.21