Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConcurrentHashMap이란? (미완) #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

BackFoxx
Copy link
Collaborator

📄 학습 내용

ConcurrentHashMap을 설명하면서, 그 기반에 있는 동시성과 스레드 관련 지식을 모조리 꺼내는 것을 목표로 하고 있습니다.

🙋🏻 세줄 요약

ConcurrentHashMap이 무엇이냐로 출발합니다.
그 과정에서 나오는 키워드, 예를 들어 크리티컬 섹션, CAS, Check and Act 같은 용어의 의미를 끝없이 물어봅니다.

👀 편하게 보기

MD

📎 관련 이슈

레퍼런스

https://blog.hexabrain.net/126
https://blog.hexabrain.net/375
https://blog.hexabrain.net/377
https://blog.hexabrain.net/401
https://blog.hexabrain.net/403

@@ -36,8 +36,7 @@ CheckA-CheckB-ActA-ActB 순서로 동작하면서 같은 문제가 발생하게
원자성이 필요한 작업에 CAS 연산을 하여 원자성을 보장합니다.

### 꼬리 3 - Volatile은 어떻게 가시성을 보장하나요? 그리고 CAS는 또 무엇이죠?
젠장 드럽게 질문만 많군 초능력 맛 좀 볼래?
면접관: 으허억... 흐어억!!

Copy link
Collaborator

Choose a reason for hiding this comment

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

ㅋㅋㅋㅋㅋㅋㅋㅋㅋ

@junpakPark
Copy link
Collaborator

  • 읽기 작업만 발생하는 변경 불가능한 즉, 불변인 Map으로 설정할 경우, 멀티스레딩 환경에서 concurrentHashMap과 HashMap 사이에 성능차이가 발생합니까?

Copy link
Collaborator

@hong-sile hong-sile left a comment

Choose a reason for hiding this comment

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

Concurrent hash map 에서 락을 어떻게 처리하나요?
-> 말씀해주신 락 방법에서 작업이 튕겨나간 다고 했느데, 이때 작업이 아예 소실되는 건가요?

ConcurrentHashMap이 동시성을 보장해준다면, redis 같은 메모리 디비를 사용을 안 해도 될 것 같아요.
ConcurrentHashMap이 redis에 비해 자주 안 사용되는 이유엔 어떤게 있을까요?
-> 스케일 아웃을 이야기해주셨는데, 만약 한정된 서버 자원이 주어진 환경과 단일 서버 구성이면, ConcurrentHashMap을 도입하는건 어떤가요?

(락 스트라이핑에 대해서 한 번 조사해보는 것도 좋을 것 같아요. ConcurrentHashMap에서 신기하게 락을 쓰더라고요)

Copy link
Collaborator

@jjongwa jjongwa left a comment

Choose a reason for hiding this comment

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

ConcurrentHashMap은 Thread Safe하다고 할 수 있나요? 어떤 과정이 Thread Safe를 보장할 수 있을까요?

LinkedHashMap 처럼 순서를 보장하는 LinkedConcurrentHashMap 이 있을까요?
없다면 어떤 식으로 구현해야 할까요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[자바 및 JVM]: HashMap과 ConcurrentHashMap의 차이에 대해 아는 만큼 설명해 보세요
4 participants