"Advanced code slag" - Operating System

process

1. Why are brought into the process?
In order to improve the efficiency of the CPU, reducing wait because the program brings CPU idle and waste of resources of another computer.

2. Why introduction thread?
In order to reduce the overhead of process switching and create, improve efficiency and save resources.

3. The difference between process and thread?
A thread is the basic unit of independent scheduling process is the basic unit of own resources.

4. Communication between processes:
shared memory:
to be mutually exclusive access to shared space
based on a shared data structure (low-level)
based on shared memory area (Senior)

管道:
	半双工通信,某一时间段只能实现单向传输。
	各个进程的访问通道互斥。
	管道满则write系统调用就会阻塞,空则read系统调用阻塞。
	没写满不允许读,没读完不允许写。
	读进程只能有一个,否则有可能读错数据。
	流管道可以双向传输。
	命名管道可以在不同的进程之间惊进行通信。

消息传递:
	传递结构化的消息。
	系统提供发送/接受原语。
	有直接通信和间接通信,直接通信直接将消息挂到对方的消息队列里面,而间接通信则将消息发送到中间体(信箱)。

Memory Management

1. Page management:
page size is fixed, usually 4K, each block into memory, just like slot, each page just to fill a slot. Discrete data can be stored. But there is no external fragmentation within fragmentation.

缺点:缺页中断的产生,选择淘汰页面,页面碎片浪费空间

2. Management Segment:
segment size is not fixed, but there is no debris in the debris outside.

3. Section page management:
easy to implement, segmentation can be shared, easy protection, dynamically linked, and can be a good solution to external fragmentation.

4. Page replacement algorithm:
the FIFO: FIFO
LRU: least recently use
LFU: currently the least used
OPT: Optimal replacement algorithm

Released nine original articles · won praise 4 · Views 133

Guess you like

Origin blog.csdn.net/qq_42661628/article/details/103996818