摘要: 1. cacheline对齐 避免读取的数据跨越2个cacheline,结构体可以cacheline对齐,连续的数组可以尝试首地址cacheline对齐,但可能造成浪费。 2. 分支预测 可以使用likely/unlikely这样的宏,提高cacheline命中的概率。 存在多个条件判断时,根据几率 阅读全文
posted @ 2020-09-27 20:08 wa小怪兽 阅读(520) 评论(0) 推荐(0) 编辑
摘要: std::thread_local是线程局部存储。每个线程都有一个对应备份,被std::thread_local修饰的变量生存周期和所属线程一致,线程被销毁该变量释放。 可以用以下代码观察: #include<iostream> #include<thread> using namespace st 阅读全文
posted @ 2020-09-20 18:25 wa小怪兽 阅读(487) 评论(0) 推荐(0) 编辑
摘要: std::initializer_list<T>提供了以下接口: size_t size() const noexcept; const T* begin() const noexcept; const T* end() const noexcept; 通过std::initializer_list 阅读全文
posted @ 2020-09-20 15:11 wa小怪兽 阅读(307) 评论(0) 推荐(0) 编辑
摘要: 有学生表和成绩表,筛选出选修超过三门课的学生信息,并按照总分排序。 如果使用where筛选count()计算结果会报错,原因是where发生在group by之前,需要使用having进行筛选。 构造的查询语句: select SNAME,SUM(GRADE) as sum,STU.STU_ID a 阅读全文
posted @ 2020-09-16 20:16 wa小怪兽 阅读(336) 评论(0) 推荐(0) 编辑
摘要: IFNULL ( exp1, exp 2) 如果exp1为空,返回exp2,exp1不为空则返回exp1。 阅读全文
posted @ 2020-09-16 20:07 wa小怪兽 阅读(127) 评论(0) 推荐(0) 编辑
摘要: Server: 1 from flask import Flask, request, jsonify 2 import json 3 import re 4 import os 5 import subprocess 6 7 conf_file_src = '/etc/nginx/nginx.co 阅读全文
posted @ 2020-07-27 23:34 wa小怪兽 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 状态机: bbr算法主要流程: 代码: 1 /* Bottleneck Bandwidth and RTT (BBR) congestion control 2 * 3 * BBR congestion control computes the sending rate based on the d 阅读全文
posted @ 2020-07-20 20:08 wa小怪兽 阅读(2433) 评论(4) 推荐(0) 编辑
摘要: tar.xz不能用tar -xvzf解压。。 xz -d 文件名 将.tar.xz文件解压成.tar文件 再tar xvf 解压.tar文件 阅读全文
posted @ 2020-07-14 17:09 wa小怪兽 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 恢复内容开始 #发送邮件 #sender: 发送者 #pwd: key #recver: 收件人 #title: 标题 #text : 内容 def sendMail(sender, sendername, pwd, recver, recvername, title, text): ret = T 阅读全文
posted @ 2020-07-10 17:45 wa小怪兽 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 以读或写打开一个FIFO会阻塞到另一端也打开。 当open一个FIFO时,非阻塞标志(O_NONBLOCK)会产生下列影响: 没有指定O_NONBLOCK,只读open要阻塞到某个其他进程为写而打开这个FIFO为止。类似的,只写open要阻塞到某个其他进程为读而打开它为止。 如果指定了O_NONBL 阅读全文
posted @ 2020-06-29 18:17 wa小怪兽 阅读(450) 评论(0) 推荐(0) 编辑