반드시 맵에 이미 존재해야 한다는 뜻이다. 그러나 해시 맵의 경우에는 그런 제약이 없다. 존재하지 않는
요소를 갱신하려 하면
BPF
는 그 요소에 대한 맵의 해싱용 버킷
bucket
을 잠근 후 새 요소를 삽입한다.
회전 자물쇠가 항상 필요한 것은 아니다. 맵에 담긴 값들을 취합(
aggregating
)하기만 하면
될 때는 굳이 잠금이 필요하지 않다. 회전 자물쇠는 여러분의 프로그램이 맵의 요소들에 대해
여러 가지 연산을 수행하는 동안 다른 프로그램들이 맵의 요소들을 절대로 변경하지 않는다는
보장이 필요할 때, 즉 다수의 연산을 “원자적으로” 수행해야 할 때 유용하다.
지금까지
BPF
맵으로 할 수 있는 여러 연산을 살펴보았다. 그런데
BPF
맵 자체는 한 종류
밖에 나오지 않았다.
BPF
는 지금까지의 예제들에 나온 해시 맵(
BPF
_
MAP
_
TYPE
_
HASH
) 외에도
다양한 유형의 맵을 제공하며, 유형마다 그 용도가 다르다. 다음 절부터는
BPF
에 정의된 모든
맵 유형을 살펴보고, 상황에 맞게
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.