The idea behind Linux

1. Linus Torvalds

Linus Torvalds twice changed the technology for the first time the Linux kernel, it helps the development of the Internet; the second is Git, source code management system of global developers to use. In an interview with TED's, Torvalds in a very open mind to discuss his unique way of working and character. Torvalds said: "I am not a dreamer, I am an engineer, I am very happy to be with dreamers, they walk the Quartet, looking at the sky, watching the sky and stars said," I think of going there. "But I'm the kind of person looking down the road, I just want to fill out the front of the pit, not to fall into, this is me."

2. About Open Source

Linus Torvalds said:

Linux is not a product of cooperation, it is me in a series of projects, purely for their own needs at the time, partly because I need to get results, but more important reason is that I enjoy programming. The end of the journey, and today (2016) 25 years later, we have not yet reached. I just want to do a full year of their own projects, I never even thought about the open-source it. But after that, as the project is growing, you will begin to want people to know. It feels like "wow, come see my results!"

Thousands of people want to get involved (Linux kernel project), but many times, that I became a break, I could not bring myself to go a step, above thousands of people to cooperate.

So Git is my second big project, meaning its existence is to maintain my first big project. In fact this is the way I work. I programmed not to ... I programming for fun, but I also wanted to do something worthwhile, so I design every program simply because of my own need.

And I like that open source software is that it allows all sorts of people together in cooperation. We do not like each other, sometimes we even hate each other . Is true, we often quarreling.

Open source scientific community is clearly a return to science was originally open source. But after becoming increasingly close, there is only on those expensive scientific journals. Open source science to its rightful, and we have arXiv and open journals.

Xiaobian something to say:

Linux open source is not a choice, but because the open-source Linux happens to be needed. As Linus Torvalds says: "purely for their own needs at the time."

Linus Torvalds is wise, he can do a good job control.

Open source code open source not only on behalf of open source is a way of working, an educational way. Because of the open source, we have more work for a better cooperation and win-win; because of open source, so that more practitioners and students can learn to better technology.

3. Code of taste

Linus Torvalds said:

Sometimes you can look at the issue from another angle, rewrite the code, excluding special case, perfect to cover all cases, this is good code. But also very simple, this is a basic principle. Details are very important. For me, I am willing to work with people, you must have good taste.

Interview Linus Torvalds compared the following two functions:

Xiaobian something to say:

Daniel are always on their own stringent requirements, not only to achieve the function, and to elegant implementation. Let us look at two code snippets interview Linus Torvalds comparison:

1. very beautiful code

remove_list_entry(entry){    prev = NULL;    walk = head;
    // Walk the list
    while (walk != entry)    {        prev = walk;        walk = walk->next;    }        // Remove the entry by updating the     // head or the previous entry    if(!prev)    {        head = entry->next;    }    else    {        prev->next = entry->next;    } }

The code above, need to distinguish between whether to remove the members for the first member of a linked list. It requires separate treatment exceptional cases (member to be removed for the first member of a linked list). This function is better understood, Xiao Bian is not here to do more to explain, if in doubt, add a small series of micro letter exchange.

 

2. good code

remove_list_entry(entry){    // The "indirect" pointer points to the    // *address* of the thing we'll update    indirect = &head;
    // Walk the list, looking for the thing that    // points to the entry we want to remove     while ((*indirect) != entry))    {        indirect = &(*indirect)->next;    }
    // .. and just remove it    *indirect = entry->next;}

This code does not need to be dealt with separately completely exceptional cases, the program as a whole is more clean and elegant. The principle which is: indirect pointer variable is stored in the address of the next member of the list member structural body (head pointer also think so), as shown below:

So variable * indirect equivalent is a former member of the next member of the list (with respect to the member you want to remove it). When members found to be removed, you can proceed as follows:

*indirect = entry->next;

This paper finishing from Linus once TED share, view the details of the original video:

https://mp.weixin.qq.com/s/qWz_8avqdWi3tVLRz5In8Q

Guess you like

Origin www.oschina.net/news/111194/behind-linux