常见I/O模型
堵塞I/O
执行read
或write
等系统调用时,应用程序会被堵塞

应用程序由用户态陷入内核态,内核检查文件描述符是否可读,存在数据时,OS内核将准备好的数据拷贝给应用程序并交回控制权
一旦执行I/O操作,应用程序会陷入堵塞状态等待I/O操作的结束
非堵塞I/O
进程把一个文件描述符设置为非堵塞时,执行read
或write
等I/O操作会立刻返回

Keep curious to the world, and do cool things that matter.
执行read
或write
等系统调用时,应用程序会被堵塞
应用程序由用户态陷入内核态,内核检查文件描述符是否可读,存在数据时,OS内核将准备好的数据拷贝给应用程序并交回控制权
一旦执行I/O操作,应用程序会陷入堵塞状态等待I/O操作的结束
进程把一个文件描述符设置为非堵塞时,执行read
或write
等I/O操作会立刻返回
加解密使用同一密钥
加密过程:明文通过加密算法和一个密钥加密成不可读的密文
解密过程:接收方使用相同密钥和解密算法解密成明文
link: https://leetcode.com/problems/climbing-stairs/description/
You are climbing a staircase. It takes n
steps to reach
the top.
Each time you can either climb 1
or 2
steps. In how many distinct ways can you climb to the top?
Example 1:
1 | Input: n = 2 |
Example 2:
1 | Input: n = 3 |
Constraints:
more >>1 | $ cat /etc/os-release |
使⽤任意并发⼯具,完成这样⼀个程序,并发请求 https://baidu.com 和 https://bing.com,任意⼀个站点先获取到了完整的 html,即中⽌另⼀个流程,并把结果输出⾄⽂件:{sitename}.html,例如百度先获取到了结果,即输出baidu.html,若 bing 先获取到了结果,就输出 bing.html。
http.Get
方法是很难中止的,所以这里用了http.NewRequestWithContext
来实现sync.WaitGroup
来进行了一个等待1 | $ cat /etc/os-release |
封装一个数据结构 MyMap,实现并发安全的 Load,Store,Delete,LoadAndDelete,LoadOrStore 几个 API(禁止使用 sync.Map),不用考虑性能
参考
1 | package main |
1 | $ cat /etc/os-release |
在本机MacOS15预览版上使用始终有问题,换用自有aliyun服务器,由于阿里云服务器代理不易设置,不好获取给的docker image,于是将本机环境的image打包后scp上去
1 | # 本机 |
位于src/runtime/proc.go
1 | // runqput tries to put g on the local runnable queue. |
极客大学业务架构实战营课程作业
对照模块 2 讲述的复杂度分析方法,分析微信朋友圈的复杂度;
针对各个复杂度,画出你的架构设计方案(无需做备选方案,只需要最终的方案即可);
给出你的架构方案中关键的设计理由。
3~5 页 PPT 即可,涵盖复杂度分析、架构设计、设计理由。
微信朋友圈属于高质量复杂度,低业务复杂度
tag:
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent: meta: false pages: false posts: title: true date: true path: true text: false raw: false content: false slug: false updated: false comments: false link: false permalink: false excerpt: false categories: false tags: true
2024-08-19
#Operating System#Network#I/O
2024-08-19
#Algorithm#Encrypt
2024-08-19
2024-08-17
#Algorithm#LeetCode#Interview#Math#Dynamic Programming
2024-08-14
2024-07-28
#Homework#Study Record#Programing Language#Go
2024-07-25
#Homework#Study Record#Programing Language#Go
2024-07-23
#Homework#Study Record#Programing Language#Go
2024-07-22
#Homework#Study Record#Programing Language#Go
2021-04-18
#Homework#Software Architecture#GeekTime#Study Record#Wechat
2021-04-07
#Homework#Software Architecture#GeekTime#Study Record#Wechat
2021-03-13
#Programing
2021-02-07
#Algorithm#LeetCode#Interview#List
2021-02-05
2021-02-05
#Algorithm#LeetCode#Interview#Hash#Double Linked List
2021-01-30
#MySQL#Database
2021-01-26
#Python#Design Patterns#Magic Function#Decorater
2021-01-22
#Linux#Shell#Python#File Processing
2021-01-20
#Linux#Tensorflow Serving#Nvidia#CUDA#CUDNN#Inference Speed
2020-09-26
#Linux#Tensorflow Serving#Evernote#tools#system code
2020-07-25
#Homework#AI#Notes#Deep Learning#CogQA#Paper
2020-07-25
#Homework#AI#Notes#Deep Learning#Paper#GAN#Semi-supervised Learning
2020-07-18
#Homework#AI#Notes#Deep Learning#Paper#GCN#Social Influence#Social Network
2020-07-11
#Homework#Machine Learning#Kernel Function#SVM
2020-07-09
#Mathematics#Limit#Sequence Convergence#Calculus#Mathematical Analysis
2020-06-19
#Homework#Machine Learning#VC Dimension
2020-03-28
#AI#Notes#Deep Learning#Paper#Computer Vision#Object Detection#Comments
2019-11-06
2019-08-01
#AI#Notes#Deep Learning#Paper#Computer Vision#Object Detection#Comments
2019-05-30
#Machine Learning#AI#Notes
2019-03-04
#MySQL#Datawhale
2019-03-03
#MySQL#Datawhale
2019-03-02
#MySQL#Datawhale
2019-03-01
#MySQL#Datawhale
2019-02-27
#MySQL#Datawhale
2019-02-25
#MySQL#Datawhale
2019-01-09
2019-01-07
2019-01-05
2019-01-04
2018-12-23
#Hexo#LaTex
2018-12-23
#Machine Learning#AI#Notes
2018-12-15
#AI#Data Mining#Practice#Model Evaluation#Grid Search
2018-12-13
#AI#Data Mining#Practice#Model Evaluation
2018-12-12
#Algorithm#LeetCode#BinarySearch#TopologicalSort
2018-12-09
#AI#Data Mining#Practice#RandomForest#GBDT#XGBoost#LightGBM
2018-12-08
#SVM#AI#Data Mining#LogisticRegression#DecisionTree#Practice
2018-12-08
#Algorithm#LeetCode#BinarySearch
2018-12-05
#Algorithm#DataStructure#BinarryTree
2018-01-09
#MySQL#Database
2017-12-30
#Python#Translations#StackOverflow
2017-12-29
#Comments#Movie
2017-12-28
#Algorithm#PAT
2017-12-28
#Algorithm#PAT
2017-12-28
2017-09-30
#MySQL#Database
2017-06-20
2017-06-13
2017-05-26
2017-03-24
2017-03-23
2017-03-22