当前位置:网站首页>Interviewer: what is the internal implementation of the list in redis?
Interviewer: what is the internal implementation of the list in redis?
2022-07-03 10:46:00 【51CTO】
While waiting in the interview room , It feels so warm , My cold rental house has to be covered with two layers of quilt to sleep . I was about to take off my coat , I suddenly heard footsteps outside the door , The door is then opened , A little sister with curved eyebrows and red lips came in , The smell of sweet perfume immediately went into my nostrils. .
The interviewer's little sister smiled and said :" Hello! , I'm the interviewer today , So let's start !”

I put away my straight eyes and hurriedly said :“ well , well .”
The interviewer's little sister said :“Redis What are the basic data types in ?”
I answered immediately :“Redis The basic data types of are : character string (string)、 list (list)、 Hash (hash)、 aggregate (set)、 Ordered set (zset).”
The interviewer's little sister said :“ What is the internal implementation of the list type ?”
I thought about it and wanted to answer :
There are two kinds of internal codes for lists : Compressed list (ziplist) And the list (linkedlist). Compressed list (ziplist) It is a sequential data structure composed of a continuous memory . A compressed list can contain any number of nodes , A byte array or integer value can be saved on each node . Linked list (linkedlist) Is passed by multiple nodes prev and next A two-way linked list composed of pointers . When the number of list elements is small and each element takes up less space , Use compressed lists . When there are a large number of list elements or an element takes up a large space , Use the list .
The interviewer's little sister said :“ You're talking about the internal code of the old version ,3.2 What does the implementation look like after version ?”
I was also immersed in the complacency of the last question , Suddenly, his expression solidified , The palms began to sweat .“ This .. Not much in-depth understanding ”, I hesitated .
The interviewer's little sister said :“ Go back and wait for the news .”
This sentence is clear , I know there is no “ then ” 了 , But not discouraged, I asked :“ Could you give me a hint ?”
The interviewer's little sister smiled and said :“ Certainly. , stay 3.2 Version start , Using a quick list (quicklist) As the internal code of list type . Quick list (quicklist) Is to compress the list (ziplist) A linked list of nodes (linkedlist), Divide the linked list into segments , Each segment uses a compressed list for continuous memory storage , Multiple compressed lists through prev and next A two-way linked list composed of pointers . It combines the advantages of compressed list and linked list , Further compress the memory usage , Further improve efficiency .”
On the way home , I think about it : You can't read , We also need to pay attention to the continuous development and evolution of Technology . Although the interview was inconclusive , But it's not without harvest .
reference :
《Redis Design and implementation 》
《Redis Development and operations 》
《Redis Deep Adventure : Core principles and application practice 》
I've seen it here , You and I must be predestined friends , Leave your give the thumbs-up and Focus on , It will become a great thing in the future .
边栏推荐
- 神经网络入门之模型选择(PyTorch)
- Mysql--索引原理+如何使用
- 权重衰退(PyTorch)
- 7、 Data definition language of MySQL (2)
- ThreadLocal原理及使用场景
- Leetcode刷题---283
- Leetcode skimming ---44
- Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported
- Practical part: conversion of Oracle Database Standard Edition (SE) to Enterprise Edition (EE)
- Nuget add reference error while installing packages
猜你喜欢

MySQL checks for automatic updates at 0:00 every day

A complete answer sheet recognition system
![[ultra detailed] implement soft and hard interval SVM based on sklearn](/img/89/b9d03ec26239d88b641f76dc95b3cd.jpg)
[ultra detailed] implement soft and hard interval SVM based on sklearn

Matrix calculation of Neural Network Introduction (pytoch)

Tensorflow—Neural Style Transfer

Leetcode skimming ---367

神经网络入门之模型选择(PyTorch)

Unity learning notes: online game pixel Adventure 1 learning process & error correction experience

Model selection for neural network introduction (pytorch)

权重衰退(PyTorch)
随机推荐
Leetcode刷题---374
Convolutional neural network (CNN) learning notes (own understanding + own code) - deep learning
Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported
Ind yff first week
Jetson TX2 刷机
8、 Transaction control language of MySQL
Leetcode skimming ---217
Type de contenu « Application / X - www - form - urlencoded; Charset = utf - 8 'not supported
Nuget add reference error while installing packages
Bid -- service commitment -- self summary
二分查找法
如何在游戏中制作一个血条
Multilayer perceptron (pytorch)
C语言项目:学生成绩系统
Numpy quick start (V) -- Linear Algebra
Ut2016 learning notes
Knowledge map reasoning -- hybrid neural network and distributed representation reasoning
Numpy quick start (II) -- Introduction to array (creation of array + basic operation of array)
神经网络入门之模型选择(PyTorch)
一个30岁的测试员无比挣扎的故事,连躺平都是奢望