mirror of
https://github.com/ElemeFE/node-interview.git
synced 2026-01-25 16:46:33 +00:00
Update process.md
This commit is contained in:
parent
769ae904fa
commit
623526e00a
23
README.md
23
README.md
@ -71,22 +71,23 @@ Hi, 欢迎来到 ElemeFE, 如标题所示本教程的目的是教你如何通过
|
||||
|
||||
<font color="blue">[阅读更多](https://github.com/ElemeFE/node-interview/blob/master/sections/event-async.md)</font>
|
||||
|
||||
## 进程
|
||||
## [进程](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md)
|
||||
|
||||
* `[Doc]` Process (进程)
|
||||
* `[Doc]` Child Processes (子进程)
|
||||
* `[Doc]` Cluster (集群)
|
||||
* `[Basic]` 进程间通信
|
||||
* `[Basic]` 守护进程
|
||||
* [`[Doc]` Process (进程)](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#process)
|
||||
* [`[Doc]` Child Processes (子进程)](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#child-process)
|
||||
* [`[Doc]` Cluster (集群)](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#cluster)
|
||||
* [`[Basic]` 进程间通信](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#进程间通信)
|
||||
* [`[Basic]` 守护进程](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#守护进程)
|
||||
|
||||
### 常见问题
|
||||
|
||||
* 进程的执行目录是什么? 有什么作用?
|
||||
* fork 是什么操作? 什么是子进程, 僵死进程?
|
||||
* 父进程或子进程的死亡是否会影响对方?
|
||||
* 什么是守护进程? 如何实现守护进程?
|
||||
* [进程的当前工作目录是什么? 有什么作用?](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#q-cwd)
|
||||
* [child_process.fork 与 POSIX 的 fork 有什么区别?](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#q-fork)
|
||||
* [父进程或子进程的死亡是否会影响对方? 什么是僵死进程?](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#q-child)
|
||||
* [什么是守护进程? 如何实现守护进程?](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#守护进程)
|
||||
|
||||
<font color="blue">[阅读更多](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md)</font>
|
||||
|
||||
`更多整理中`
|
||||
|
||||
## IO
|
||||
|
||||
|
||||
@ -6,21 +6,14 @@
|
||||
* `[Basic]` 进程间通信
|
||||
* `[Basic]` 守护进程
|
||||
|
||||
> 进程的当前工作目录是什么? 有什么作用?
|
||||
> <a name="q-cwd"></a> 进程的当前工作目录是什么? 有什么作用?
|
||||
|
||||
当前进程启动的目录, 通过 process.cwd() 获取, 通常是命令行启动的时候所在的目录 (也可以在启动时指定), 文件操作等使用相对路径的时候会相对当前工作目录来获取文件.
|
||||
|
||||
> fork 是什么操作?
|
||||
|
||||
fork 是拷贝当前进程的状态来 clone 一个新的进程, 这种进程被称为子进程.
|
||||
|
||||
> 父进程或子进程的死亡是否会影响对方? 什么是僵死进程?
|
||||
> <a name="q-child"></a> 父进程或子进程的死亡是否会影响对方? 什么是僵死进程?
|
||||
|
||||
子进程死亡不会影响父进程, 不过 node 中父进程会收到子进程死亡的信号. 反之父进程死亡, 子进程也会跟着死亡, 如果子进程没有随之终止而继续存在的状态, 被称作僵死进程.
|
||||
|
||||
> 什么是守护进程? 如何实现守护进程?
|
||||
|
||||
守护进程是不依赖终端(tty)的进程,不会因为用户退出终端而停止运行的进程。普通的进程,在用户退出终端之后就会直接关闭。通过 & 启动到后台的进程,之后会由于会话(session组)被回收而终止进程。实现可以参见 [Nodejs编写守护进程](https://cnodejs.org/topic/57adfadf476898b472247eac), 面试的时候能说清楚原理就行了.
|
||||
|
||||
## 简述
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user