day38 homework

## Brief History of operating system development
1. vacuum tubes and punch cards
advantages:
programmer exclusive resources in the entire period of application, it can instantly debug your program (a bug can be processed at once)
Cons:
waste of computer resources, a Only one person uses it during the time period.

2.
Advantages of transistor and batch processing system : batch processing saves machine time
disadvantages: 1. The whole process requires human participation to control, move the tape around (the two middle people)
2. The calculation process is still sequential calculation-" Serial
3. The computer that programmers used to enjoy for a period of time, must now be unified into a batch of jobs. The process of waiting for the results and re-debugging requires that all other programs of the same batch have been completed (this is a huge Affects the development efficiency of the program and cannot debug the program in time)

3. Multiplexing in integrated circuit chips and multiple programming
spaces in
time

4. Personal computer


## Brief history of process development and algorithm evolution
First come first served (FCFS) scheduling algorithm
short job (process) priority scheduling algorithm
time slice rotation (Round Robin, RR) method
multi-level feedback queue scheduling algorithm


## Brief description of multi-channel technology
Multi-channel technology refers to multiple programs. The implementation of multi-channel technology is to solve the problem of ordered scheduling of multiple program competition or sharing the same resource (such as CPU). The method is multiplexing. Multiplexing is divided into multiplexing in time and multiplexing in space.
Spatial reuse: Divide the memory into parts, and put each part into a program, so that there are multiple programs in the memory at the same time.
When a program is waiting for I / O, another program can use the CPU. If enough jobs can be stored in the memory at the same time, the CPU utilization can be close to 100%, similar to the overall planning method learned by our primary school mathematics. (After the operating system adopts multi-channel technology, it can control the switching of processes, or compete for cpu execution rights between processes. This switching will not only be performed when a process encounters io, a process takes too much CPU time Will also switch, or be taken away by the operating system cpu execution authority)


## Brief description of synchronous asynchronous blocking non-blocking concept
synchronization: The so-called synchronization is that when a function call is issued, the call will not return before the result is obtained.

Asynchronous: The concept of asynchronous is opposite to synchronous. When an asynchronous function call is issued, the caller cannot get the result immediately. When the asynchronous function is completed, the caller is notified by status, notification or callback.

Blocking: Blocking the call means that the current thread will be suspended before the result of the call returns (if an io operation is encountered). The function activates the blocked thread only after getting the result.

Non-blocking: Non-blocking corresponds to the concept of blocking, which means that it will return immediately before the result cannot be obtained immediately, and the function will not block the current thread.


## Two ways of writing process creation
from multiprocessing import Process
import time


def task(name):
print('%s is running'%name)
time.sleep(3)
print('%s is over'%name)


if __name__ == '__main__':
# 1 Create an object
p = Process (target = task, args = ('jason',))
# Even if there is only one element in the container type, it is recommended to use a comma to separate
# 2 Start the process
p .start () # Tell the operating system to help you create a process asynchronous
print ('main')

 

from multiprocessing import Process
import time

class MyProcess(Process):
def run(self):
print('hello bf girl')
time.sleep(1)
print('get out!')

if __name__ == '__main__':
p = MyProcess()
p.start()
print('主')

Guess you like

Origin www.cnblogs.com/python--wang/p/12756320.html