Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update design doc #143

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update doc
  • Loading branch information
dingweiqings committed Aug 1, 2023
commit 247843e5cca13f4ec699e3e787c6be52e142db7f
4 changes: 2 additions & 2 deletions 并发模型.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Server是http服务器的包装类,主要负责开启端口监听和启动事
这个类作用是将reactor实体化,变成机器中可运行的线程
#### EventLoop 对应于反应堆理论模型中的reactor
**Poller** 事件获取器
不断调用epoll_wait系统调用,获取新的active事件
不断调用epoll_wait系统调用,获取新的active事件
**Event Handler** 事件处理器
对于上一步poll出的事件,回调响应的处理接口,这一层是和业务处理和结合点.
总的来看,EventLoop即是事件循环,每次从poller里拿活跃事件,并给到Channel里分发处理。
Expand Down Expand Up @@ -81,7 +81,7 @@ HttpData是用来读写socket数据,转换解析http 协议的数据,并做
Server::handNewConn()
```
#### Channel类 表示通信模型中的信道,向下对接网络通信的,向上对接业务层
Channel是Reactor结构中的“事件”,它自始至终都属于一个EventLoop,负责一个文件描述符的IO事件,在Channel类中保存这IO事件的类型以及对应的回调函数,当IO事件发生时,最终会调用到Channel类中的回调函数。因此,程序中所有带有读写事件的对象都会和一个Channel关联,包括loop中的eventfd,listenfd,HttpData等。
Channel是Reactor结构中的“事件”,它自始至终都属于一个EventLoop,负责一个文件描述符的IO事件,在Channel类中保存这IO事件的类型以及对应的回调函数,当IO事件发生时,最终会调用到Channel类中的回调函数。因此,程序中所有带有读写事件的对象都会和一个Channel关联,包括loop中的eventfd,listenfd,HttpData等。
## 日志记录设计
Log的实现了学习了muduo,Log的实现分为前端和后端,前端往后端写,后端往磁盘写。为什么要这样区分前端和后端呢?因为只要涉及到IO,无论是网络IO还是磁盘IO,肯定是慢的,慢就会影响其它操作,必须让它快才行。

Expand Down