Linux provides the memory map feature, which implements the mapping of physical memory pages into the process address space for efficient data manipulation or transfer. The kernel uses three important data structures struct vm_area_struct , struct anon_vma and struct anon_vma_chain to handle this feature, so it is important to understand these three data structures, and this article tries to clarify the origin and connection between them.
vma The struct vm_area_struct is often referred to as vma in kernel code, so This structure is referred to by vma in the following.
Introduction to Browser Fingerprinting Technology
In daily life, biometric technology is already standard in most smartphones, and most phones are equipped with face recognition and fingerprint recognition, and the current fingerprint recognition technology is already very mature. But what we want to talk about today is not the fingerprint recognition in biometric technology, but the browser fingerprint. Many people love and hate this technology, why is this? Then we’ll take a deeper look at browser fingerprinting today.
eBPF, a Linux kernel monitoring technology
BPF is a very flexible and efficient virtual machine-like component in the Linux kernel, capable of safely executing bytecode at many kernel hook points. This article briefly organizes the technical principles and application scenarios of eBPF.
eBPF Origins BPF is called Berkeley Packet Filter, as the name suggests, BPF was originally used for packet filtering and was used in the tcpdump command, for example running a filter rule like tcpdump tcp and dst port 443 would copy packets with protocol tcp and destination port 443 to the user state.
Google B-Tree
B-Tree and its variants data structures are widely used in storage systems, database systems, mainly as indexes for dynamic random access data scenarios. google/btree (github.com) is a pure in-memory B-Tree implementation written in Go, and its source code is analyzed in this paper.
Overview B-Tree structure Organization and maintenance of large ordered indices This paper presents the B-Tree data structure. The query of B-Tree starts from the root node and performs a dichotomous lookup of the ordered data within the node and ends the query if it hits, otherwise it goes to the child node query up to the leaf node.
Radix Tree and Gin Implementation
Overview Trie Trie, also known as dictionary tree and prefix tree, is a multinomial tree structure, whose core idea is space for time, using the common prefix of strings to reduce unnecessary string comparisons to improve query efficiency. The figure below.
It can be seen that two keywords with a common prefix have the same path in the prefix part of Trie, so Trie trees are also called prefix trees.
Talking about distributed lock implementation
In distributed systems and microservice architectures, different systems or different nodes of the same system share the same or a set of resources, then access to these resources often requires mutual exclusion to prevent interference with each other and ensure consistency.
Distributed locks provide mutually exclusive access to shared resources in a distributed environment, and businesses rely on distributed locks to pursue efficiency gains or rely on distributed locks to pursue absolute mutual exclusivity of access.
JavaScript ESM is great, but it might not be so great right now
Preface As many front-end developers probably know, more than a year since sindresorhus published the esm only manifesto last year, many projects have started to move to esm only, i.e., esm only and not cjs, in order to force the whole ecosystem to migrate to esm only faster. Some popular projects already do this thousands of npm packages maintained by sindresorhus node-fetch remark series more. They claim: you can still
Map In Golang
Introduction This article is mainly to learn and understand the characteristics of map by exploring the data structure and source code implementation of map in golang, containing a total of map’s model exploration, access, expansion, etc..
Map’s underlying memory model The underlying struct that represents map in golang’s source code is hmap, which is short for hashmap.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 type hmap struct { // The number of elements stored in the map, which is returned directly when len(map) is called in golang count int // The status marker bit, which can be used to determine whether or not the current status is in this state by performing & operations with the defined enumeration value flags uint8 B uint8 // 2^B denotes the number of buckets, B denotes the number of bits after the hash to group the buckets noverflow uint16 // Approximate number of overflow buckets hash0 uint32 // hash seed is generally a prime number buckets unsafe.
Forced deletion of Kubernetes Namespace
1. Preface I was using Kubernetes and had a problem with a Kubernetes NameSpace not being deleted properly.
The NameSpace status had been in Terminating for quite a while, and I decided to force the NameSpace to be deleted.
2. Steps 1. View the existing NameSpace 1 2 3 4 5 6 7 8 [root@master ~]# kubectl get ns NAME STATUS AGE default Active 5h46m istio-system Terminating 11m kube-node-lease Active 5h46m kube-public Active 5h46m kube-system Active 5h46m kubernetes-dashboard Active 5h46m 2.
Implementation of string in libc++
std::string is probably one of the most common standard library data structures used by C++ programmers, how is std::string implemented internally after so long? What exactly is SSO (Small String Optimization)? I’ve recently become interested in the code of libc++, so I’ll use its implementation as an example to briefly answer the above questions. (Note that I have trimmed down the code shown a bit for ease of narration!)
Internal structure My version of libc++ here is 37db2833.
Match-Case in Python 3.10
Preface Many Python core developers thought that Python didn’t need to add switch-case syntax, because you could do the same thing with if/elif/else. In fact, Guido himself wasn’t interested in this syntax either, so it wasn’t until Python 3.10 that a new match-case was added. This new syntax is called Structural Pattern Matching, and since there are a lot of new features, there are three PEPs to introduce it. PEP
Flannel for Cloud-Native Virtual Networks
When I used to look at k8s related knowledge, my network knowledge was relatively weak, so I didn’t understand the Flannel network. So recently I researched some knowledge of cloud-native virtual networks and wrote two articles: VXLAN Protocol for Cloud-Native Virtual Networks and Cloud-native virtual networking tun/tap & veth-pair which introduced some knowledge of virtual networks. These are all for flannel, and now we finally come to the Flannel article.
Inode in the Linux file system
File System The file system is the subsystem of the operating system responsible for managing persistent data. To put it simply, it is responsible for saving the user’s files to the disk hardware, because even if the computer loses power, the data in the disk is not lost, so the files can be saved persistently.
The basic data unit of a file system is the file, and its purpose is to organize and manage the files on disk, and the different ways of organizing them result in different file systems.
Tekton Practices
Previously we explained the use of the Jenkins pipeline to implement CI/CD for Kubernetes applications, now we will migrate this pipeline to Tekton, in fact, the overall idea is the same, that is, to divide the entire workflow into different tasks to perform, the previous workflow stages are divided into the following stages: Clone code -> unit testing -> compile and package -> Docker image build/push -> Kubectl/Helm deployment services/.
Practices of multi-label based issue-driven software development
Software devours the world, open source devours software! The issue driven development model based on an issue tracking system has not only had a significant impact on the development process of open source systems, but more and more companies and organizations in the commercial software development space are also using the issue-driven development approach.
For the issue mentioned here, we can’t just understand it as bug in the past, that would be too narrow and outdated.
Resetting the root password for MySQL8
This article explains how to set the initial root password of MySQL 8.0 in CentOS7 and how to reset the root password after forgetting it.
1. First login If MySQL is just installed, it will generate a random password in the log file by default, we can use it to login and reset the password.
1 2 3 4 $ sudo grep 'temporary password' /var/log/mysqld.log 2019-11-22T16:40:10.133730Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: >KG6Ybt3%lgo $ mysql -u root -p Enter password: To reset the password you can use the following command.
Using ntfsfix to solve the problem of not being able to mount NTFS drives under Linux
Use ntfsfix to solve the problem of not being able to mount NTFS hard disk under Linux, mainly by the problem of $MFT file of hard disk partition, you can use chkdsk command under windows or use ntfsfix under Linux to fix it.
First the failure details.
1 2 3 4 5 6 7 8 9 10 $ sudo mount /dev/sda1 $MFTMirr does not match $MFT (record 3). Failed to mount '/dev/sda1': Input/output error NTFS is either inconsistent, or there is a hardware fault, or it's a SoftRAID/FakeRAID hardware.
Managing Jenkins build nodes with Kubernetes' built-in PodTemplate
Jenkins integrates well with Kubernetes, whether it’s a controller or a build node (agent) running as a Pod on Kubernetes. Anyone familiar with Jenkins knows that Jenkins supports multiple types of build nodes, such as fixed configuration and dynamic configuration. The way nodes connect to the controller includes JNLP, SSH, and so on. For those who are already fully embracing container technology, most of them use build nodes by connecting to Kubernetes clusters and dynamically starting and destroying Pods.
Understanding the ECMAScript Advanced Syntax Compilation and Helper Handling Scheme from the tsconfig parameter importHelpers
1 Introduction to TypepScript Syntax Compilation and Helper Functions Using TypepScript’s built-in tsc tool, you can translate ts source files into standard JavaScript code files. The configuration file tsconfig.json can be used to configure the specific scheme of tsc compilation.
The tsc compilation parameter target specifies the language standard version of the output, so in practice it can also be used as a tool to translate higher versions of ECMAScript source code to lower versions.
React: useNavigate() may be used only in the context of a Router component
When we try to use the useNavigate hook outside the Router context of a react router, we get the warning “useNavigate() may be used only in the context of a Router component”. To fix this issue, you can only use the useNavigate hook in the Router context.
Here is an example of wrapping a React application in a Router in the index.js file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // index.