250x250
Notice
Recent Posts
Recent Comments
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Archives
Today
Total
관리 메뉴

SYDev

[운영체제] Exercise 2. Process Management 본문

3학년 2학기 전공/운영체제

[운영체제] Exercise 2. Process Management

시데브 2024. 10. 10. 02:00
728x90
경희대학교 허선영 교수님의 운영체제 수업을 기반으로 정리한 글입니다.

 


Part 2: Process Management

Goals of this Exercise

  • basic concept of processes and threads
  • how operating systems provide concurrency
  • how to apply scheduling algorithms

 

Task1

Task 1.1: Process State

- context switching 사이에, Process Control Block가 어떻게 사용되는지 서술

During context switching, the kernel saves the state of the current process (into pcb) and restores the state of the next process (from pcb).

 

Task 1.2: Memory Layout

  • process의 current activity -> program counter와 registers의 값에 의해 표현됨
  • memory layout은 4가지로 분할
    • text section - 실행되는 코드
    • data section - 전역 변수
    • heap section - 동적 할당되는 공간(during program runtime)
    • stack section - 임시 변수 (함수 호출 - 함수의 parameters, return addresses, local variables)
  • text & data section -> fixed size
  • heap & stack -> flexible size
  • activation record(stack frame): 함수 호출 하나에 필요한 data를 모아놓은 memory 공간 -> function이 호출될 때 push, control이 끝나고 pop
  • heap & stack -> grow toward one another -> os가 둘이 overlap되지 않도록 보장해야함

 

  • 각 thread마다 memory 공간에서 stack을 가짐

-  Processes와 비교했을 때, threads의 장점

multi-processing과 달리, threads는 같은 process 내부에서 code, registers, files를 공유하여 multi-threading은 상대적으로 overhead가 적게 발생 -> cost 면에서 효율적

 

Task 2: Short Caculations

(1) program의 serial portion이 20%, 4개의 core가 있을 때, Amdahl's law에 따른 speedup

 

(2) 5 processes가 한 번에 도착, bust time은 3, time quantum 2의 round-robin scheduling을 적용했을 때, maximum waiting time?

 

 

Task 3: Real-Time Scheduling

(1) Rate Monotonic (RM)

 

(2) Earliest Deadline First (EDF)

 

Task 4: Reali-World Scenario

Task 4.1: Process creation with fork()

 

Task 4.2: Multithreading with Pthread

728x90