The thinking of the human brain
Life is doing; it is one thing after another; eating is a thing, sleeping is a thing, working is a thing; and the sum of these things adds up to life.
Then there are many things to deal with in our life. Of course, we do them one by one. If we have two things to do at the same time, how do we deal with them? There are probably the following:
- Emergency important
- Emergency doesn’t matter
- Not urgent important
- It doesn’t matter if it’s not urgent
In plain English, we rank them, or more precisely, prioritize them, what needs to be done first, and what can be delayed. That’s how the human brain thinks. Let’s look at how the computer thinks.
Computer processing
First come, first served
Whichever comes first, do first
This has an advantage, is fair, but the disadvantages are obvious, for example, A first, we began to do A, do 3 days have not finished, behind B impatient, B said: I t fart big point of matter, A few minutes can finish, you let me wait for 3 days, this is A person to do.
So the problem appears, if the front of the things need a long time, and then the things need a very short time, at this time in front of the moment not to finish, behind and so on in a hurry, so, not desirable!
Short work priority
Whichever takes less time, do first
In order to solve the above problems caused by first come, first service, we take A short assignment priority, such as when A first come, but after A need 3 days, at this point B, B would be done only need one hour, then we will do B first, so that it can guarantee as much as possible to get it done as soon as possible, but the problem appeared again, B finished do C, D C finished do, Because they all need A very short time, and A has not been implemented, more importantly: A is the boss proposed! Three days later, the boss spoke: why is it not finished? So what do we do? We can use a priority algorithm.
High priority
Whichever has a higher priority, do it first
We can add an index of importance to each task, which is called priority. Those with higher priority can be executed first, and those with higher priority can be finished first. However, there is A problem again. Then we look at A, B, C who need the short time, that is to say: the same priority, we according to the short work priority, then if the time is also the same, then we look at who came first, that is, first come first service, then if together to? WTF!!!!
Time slice rotation
A does part and then B, B does part and then C, C does part and then D… So on
Same as above, what if two tasks A and B, with the same priority and the same time, arrive together? We can do this: first do A for A while, then do B for A while, then do A for A while, then do B for A while, so that A and B feel that he has been working for me, without delaying us, we are very satisfied! This is called time slice rotation. This can be used to simulate multiple people: for example, I open two wechat accounts at the same time, and chat with two people at the same time, although I am a person, and can only send a message to one wechat, but as long as I switch fast enough, the opposite two wechat friends think I have been chatting with him alone! This is called macroscopically parallel and microscopically serial. This is how computers can open multiple applications at the same time.
High response ratio is preferred
Do what you can do immediately
For example: A needs to be done right away, but I need something to do when I do A, which I don’t have right now, so I can only do it when it arrives, so I can’t wait. B doesn’t need to wait for anything, but I can start right away, so I’ll do B first. This is called high response ratio priority. The so-called response: can be understood as the efficiency of doing things. If you wait for A, then you have not done anything. If you are doing B without waiting for what A needs, then you have been working all day and your efficiency is 100%. If the boss sees you being so efficient, he will definitely get A raise!
Computer thought, probably so several, as to the choice of which way, still have to see the occasion to choose.