编辑
2023-11-12
英语学习
00

Overview

The Linux kernel requires very little moderation from a system user or system administrator. Designed to be forgotten, the Linux kernel handles a computer’s drivers and low level processes. The weight of the kernel’s code makes manual editing, while possible, proves difficult and most kernel maintenance is done through kernel upgrades. All Linux distributions provide the opportunity to upgrade the kernel, but depending on the release structure and maintainers looks different. Arch-based systems will upgrade the kernel when a new kernel is pushed to the repository, where more stability focused distributions such as Debian and derivatives do not upgrade from the standard package manager. As a rule of thumb with much of technology, if you do not see any performance or stability concerns, it may be best to leave the kernel as is.

编辑
2023-11-12
linux
00
  1. Linux:Linux操作系统通常使用GRUB2(或GRUB v2)作为默认的引导加载程序[1]。GRUB2是Linux的事实标准引导加载程序,它具有强大的功能和灵活性,可以支持多个操作系统的引导。

  2. Windows:Windows操作系统使用BOOTMGR作为引导加载程序[1]。BOOTMGR负责加载Windows操作系统,并提供引导菜单以选择不同的启动选项。

编辑
2023-11-12
Redis源码阅读
00

创建zset

c
robj *createZsetObject(void) { zset *zs = zmalloc(sizeof(*zs)); robj *o; zs->dict = dictCreate(&zsetDictType); zs->zsl = zslCreate(); o = createObject(OBJ_ZSET,zs); o->encoding = OBJ_ENCODING_SKIPLIST; return o; }
编辑
2023-11-12
数据结构与算法
00
cpp
#include <iostream> #include <cstdlib> #inc
编辑
2023-11-12
Redis源码阅读
00

Redis中的跳表(skiplist)是一种有序的数据结构,它通过在每个节点中维护多个指向其他节点的指针,从而实现快速访问。跳表在插入、删除和查找操作上的平均复杂度为O(logN),最坏情况下为O(N),与红黑树相媲美,但实现起来比红黑树简单很多[1]

跳表的数据结构定义在Redis的server.h文件中,包括跳表节点(zskiplistNode)和跳表(zskiplist)两个结构体。跳表节点包含成员对象、分值、后向指针和层等属性;而跳表包含表头节点、表尾节点、节点数量和最大层数等属性[1]

Redis中关于跳表的相关操作函数定义在t_zset.c文件中,下面分别介绍几个基本操作函数的实现源码。