Skip to content

운영체제 12회#64

Merged
102092 merged 4 commits intomainfrom
han
Nov 3, 2021
Merged

운영체제 12회#64
102092 merged 4 commits intomainfrom
han

Conversation

@102092
Copy link
Copy Markdown
Contributor

@102092 102092 commented Oct 11, 2021

issue : #61, #62
due date : 2021/10/19

@102092 102092 requested a review from sigridjineth October 11, 2021 08:45
@102092 102092 self-assigned this Oct 11, 2021
sigridjineth
sigridjineth previously approved these changes Oct 30, 2021
Copy link
Copy Markdown
Contributor

@sigridjineth sigridjineth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고 많으셨습니다 👍

- Interrupt는 자원들이 CPU에게 자신의 상태를 알리는 방법이고..
- 인터럽트는 하드웨어, 소프트웨어 인터럽트로 나눌수 있을듯.
- 하드웨어는.. 모니터 마우스 등등이고..
- 소프트웨어는 CPU 자신이 인터럽트를 사용하는 경우 인듯.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

software interrupt에는 어떤 경우가 있을까요?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어떤 프로그램을 실행하면서, 유저에게 특정 화면을 보여주거나, 특정 파일을 실행하는 경우를 말할 수 있을듯 합니다.

참고




- Interrupt가 실행되는 과정
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 테코톡이 정리가 좋네요...

Copy link
Copy Markdown
Contributor Author

@102092 102092 Oct 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 많이 참고하고 있습니다.
저희 주제와 연관된 테코톡이 있으면 , 거기에 영문 자료를 더해서 공부하는 게 베스트인듯 싶습니다.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@102092 네 남이 잘 정리했는데 굳이 바퀴를 재발명할 이유는 없지만.. 맥락을 알고 싶을 때 뜯어봐야지요!

- Context Switching이 왜 발생?
- CPU는 한번에 하나의 프로세스만 처리할 수 있기에.
- 여러 프로세스를 실행, 중단 하면서 작동하기에.
- 이 비용이 비싸기에, Mutil Thread 환경이 나오지 않았을까
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Process Context Switching과 Thread Context Switching에 대해 비교해주세요!
링크

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thread Context Switching이 Process 보다 효율적이지 않을까 싶어요.

Thread 기반은 같은 프로세스내에서 진행되는 만큼, 많은 메모리 부분이 공유되므로 다른 스레드로 전환할 때, 힘들지 않지만 (해당 스레드를 위한 정보가 이미 프로세스에 있어서)

Process Context Switching은 해당 프로세스 실행 위한 정보들을 가져와서 메모리에 올려야 하므로.. 더 많은 비용을 지출한다고 볼 수 있겠네요

참고


- 참고 키워드
- idle : CPU가 아무일도 하지 않는 상태
- idle이 겹칠 경우를 오버 헤드라 말함.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PCB 내부에는 다음에 실행할 프로세스의 주소를 가지고 있다. (PC : Program Counter)
그리고 프로세스 상태 정보 및 레지스터 세트(누산기, 인덱스 레지스터, 스택 포인터...) 등 있는데 이러한 PCB를 위의 과정으로 거치게 되면 컨텍스트 스위칭을 진행하는 프로세스는 idle 상태(유휴 상태)가 발생한다.
이러한 프로세스의 idle 상태는 결과적으로 프로그램의 성능을 낮춘다. 따라서 잦은 컨텍스트 스위칭을 오버헤드(Overhead)를 일으킨다.
링크

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

프로세스의 상태가 idle을 가지는 경우가 잦아질 경우,
성능이 저하되고, 결국엔 좋은 퍼포먼스를 내지 못하는 현상을
컨텍스트 스위칭에 따른 오버헤드 라 부르는 듯 싶은데, 맞을까요?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네, 저도 그렇게 이해합니다.


- Database (MySQL)

- **상호 거래 패턴**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

상호 거래패턴의 교착상태는 어떻게 해결할 수 있을까요?
keyword: table의 PK값 기준 처리

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

트랜잭션을 쪼개면 되는걸까요?
하나의 트랜잭션 내부에서 -10 + 10을 진행하는 것이 아닌,

  1. A balance -10
  2. B balance -10
  3. A balance + 10
  4. B balance + 10

이렇게 하면 될듯 싶어요

참고

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋습니다!




### 탐지 및 복구
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아래 설명만 봐서는 잘 모르겠네요. 이거 하나 꼭지만 잡고 공부할 거리라고 생각되네요.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이론적인 정리이기 때문에 이해하기 힘든게 아닌가 싶네요.
저도 그렇구요.

application단에서 어떻게 데드락을 탐지하고,
DB에 따라 어떻게 데드락을 복구하는 프로세스를 실행하는지
한번 알아봐도 재밌을듯 싶습니다!


## 실제 시스템에서 교착 상태

- Database (MySQL)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MySQL이 나와서 그런데, InnoDB에서는 기본 잠금방식이 어떠고 다른 DB에서는 어떠고 이것도 살펴봐도 좋을 것 같네요. 애시당초에 InnoDB 등 DB 엔진에 대한 학습을 해본 적이 없어서, 나중에 한번 이슈로 올릴게요.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋습니다.
저도 InnoDB에 대해 조금 더 깊게 이해할 필요가 있다고 생각이 드네요

Copy link
Copy Markdown
Contributor

@sigridjineth sigridjineth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고 많으셨습니다! ORE 기간 중이라 꼼꼼하게 보지는 못했어요. 아마 여기서 더 짚어볼 주제들이 있을텐데 다음에 추가로 더 해보죠.

@102092 102092 merged commit 6acc8a7 into main Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants