This post contains some relative lower layer Computer System questions. Updating…
在此收录一些关于比较底层的计算机系统问题。更新中…
CPU Cache 高速缓存
TLB
- Store cached translation of Virtual Address to Physical Address.
MMU (Memory Management Unit)
- Translate virtual address to physical address in hardware way.
- Might have Virtual Address Cache and Physical Address Cache to speed up the look up.
Memory Management 内存管理
- Shared Memory.
- Copy on Write.
Page Table 页表
- What is Page Table?
- Page Table is in memory.
Process 进程
Daemon Process 守护进程
- It could detach from terminal and run in background.
- Not exit with the exit of created terminal.
fork()
& exec()
- First
fork()
thenexec()
to avoid lost the current state of process.- Caused by history problem of original computer only has terminal shell to access.
- Linux uses copy-on-write to optimize the large process
fork()
.
Orphan Process 孤儿进程
- Parent process terminated or crashed, creating orphan process
- Re-parenting will assign orphan process to init process in most UNIX os.
- The process group mechanism in most Unix-like operating systems can be used to help protect against accidental orphaning
- in coordination with the user’s shell will try to terminate all the child processes with the “hangup” signal (SIGHUP), rather than letting them continue to run as orphans.
- precisely, as part of job control, when the shell exits, because it is the “session leader” (its session id equals its process id), the corresponding login session ends, and the shell sends SIGHUP to all its jobs (internal representation of process groups).
Zombie Process 僵尸进程
- A zombie process or defunct process is a process that has completed execution (via the exit system call) but still has an entry in the process table: it is a process in the “Terminated state”. This occurs for child processes, where the entry is still needed to allow the parent process to read its child’s exit status: once the exit status is read via the wait system call, the zombie’s entry is removed from the process table and it is said to be “reaped”.
- Might result in no available process id.
Segment Fault 段错误
- A fault raised by hardware with memory protection, notifying an OS the software has attempted to access a restricted area of memory (a memory access violation). On standard x86 computers, this is a form of general protection fault. The OS kernel will, in response, usually perform some corrective action, generally passing the fault on to the offending process by sending the process a signal. Processes can in some cases install a custom signal handler, allowing them to recover on their own, but otherwise the OS default signal handler is used, generally causing abnormal termination of the process (a program crash), and sometimes a core dump.