首先,在 Linux 下清理缓存是毫无意义的,只有弊,没有利。原因可参考下文。
[Linux ate my ram!]
http://www.linuxatemyram.com/
继续阅读“为什么 /proc/sys/vm/drop_caches 的值不归零?”
月份:2016年3月
Linux 下创建简单的守护进程(Daemon)
守护进程运行在背景,其父进程 pid=1(init/systemd). 创建守护进程的主要思路,就是 fork 一个子进程,然后父进程挂掉让子进程变为孤儿,最终孤儿被 pid=1 的进程领养。
Daemon 的创建步骤 (SysV)
1. Fork
fork off the parent process & let it terminate if forking was successful. -> Because the parent process has terminated, the child process now runs in the background.
2. Setsid
setsid - Create a new session. The calling process becomes the leader of the new session and the process group leader of the new process group. The process is now detached from its controlling terminal (CTTY).
3. Signal
Catch signals - Ignore and/or handle signals.
4. Fork again
fork again & let the parent process terminate to ensure that you get rid of the session leading process. (Only session leaders may get a TTY again.)
5. chdir
chdir - Change the working directory of the daemon.
6. umask
umask - Change the file mode mask according to the needs of the daemon.
7. Close FDs
close - Close all open file descriptors that may be inherited from the parent process.
吉隆坡第二国际机场(KLIA2)吃喝购物简介
KLIA2 是个友好的廉航机场,连接着 KLIA2 的商场 Gateway@KLIA2 卖的东西跟市区一个价,可选择的还不少。可惜没有电影院。
继续阅读“吉隆坡第二国际机场(KLIA2)吃喝购物简介”