Home  >  Article  >  System Tutorial  >  Linux slang explained: What are upstream and downstream?

Linux slang explained: What are upstream and downstream?

WBOY
WBOYforward
2024-02-11 11:57:20942browse

The terms "upstream" and "downstream" can be said to be quite abstract, and ordinary people may rarely use them. If you are just a regular user using Linux and not involved in writing and maintaining software, then these terms may not have practical meaning to you. However, these terms are very useful when communicating between various communities in the Linux world.

Linux 黑话解释:什么是上游和下游?

The terms "upstream" and "downstream" are widely used in non-computer fields such as networking, programming, kernel and even supply chain. When discussing upstream and downstream, background information is important.

Simply put, upstream and downstream describe the direction of information flow.

Since we are all reading this while connected to the internet, let’s look at an upstream/downstream example that applies to an Internet Service Provider (ISP). Here, the ISP is focused on traffic. Upstream traffic refers to data coming from users on different ISPs. For example, if you have a website that offers subscription newsletters, the subscription information I send is the upstream data.

Downstream traffic refers to data sent from one user to another user on a different ISP, it is considered downstream traffic. Using the same subscription example, let's say my subscription request is approved and I receive a "welcome" note in one email and the latest newsletter in another. In this case, the data flows downstream because it's sent by you (well, probably as automated software acting on your behalf) to me, a user from a different ISP.

Summary: What I need or want (your communications) is upstream. What you provide me (the welcome message and the actual communication) is downstream.

Whether the data is upstream or downstream may not matter to us users, but it does to server administrators who monitor bandwidth usage, as well as distributors (producers of distributions) and programmers. Very important.

In the Linux world, there are two main contexts, upstream and downstream. One is about the kernel and the other is about the application. There are others, but I hope I can express my thoughts through these two.

Upstream and downstream in the context of the Linux kernel

Linux is the kernel. Linux distributions start with unmodified kernel source code when creating a distribution. Then add the necessary patches and configure the kernel. The configuration of the kernel is based on the features and options the distribution wants to provide. Once decided, the core was created accordingly.

The original kernel comes from the distribution's upstream. When the distribution gets the source code, it flows downstream. Once a distribution gets the kernel code, it stays with the publisher while it is modified. It remains upstream to our users until it is ready to be released.

The release creates a version of the kernel that will add patches and enable certain features and options. This configuration is determined by the publisher. That's why there are several Linux flavors, for example, Debian' www.debian.org vs. Red Hat' www.redhat.com. Publishers decide which options are made available to their user base and compile the kernel accordingly.

Once this work is completed, it is placed in a repository ready for release and we can obtain a copy. This copy flows downstream towards us.

Similarly, if a publisher finds a bug in the kernel, fixes it, and then sends the patch to the kernel developers so they can patch the kernel for everyone downstream. This is called a contribution to upstream because the traffic here flows upward toward the original source.

Upstream and downstream in the context of the application

Again, technically speaking, Linux is the kernel and everything else is add-on software. Publishers also include additional software in their projects. In this case, there are several upstreams. A distribution can contain any number of applications such as X, KDE, Gnome, etc.

Let's imagine that you are using the nano🔗 www.nano-editor.org editor and find that it is not working properly, so you submit a bug report to the distribution. The publisher's programmers will look at it and if they find that they have inserted a bug in nano, they will fix it and release a new version in their repository. If they find that they did not create the bug, the publisher will submit a bug report to the upstream nano programmers.

When it comes to things like bug reports, feature requests, etc., it's best to send them upstream to the publisher, as they maintain the kernel and add-on applications for the distribution you're using. For example, I use a distribution called Q4OS - q4os.org on several machines. If I find a bug in the program, I will report it to the people at Q4OS. If you happen to be using Mint's linuxmint.com, you'll report it to the Mint project.

For example, if you post a question on a regular Linux forum and you mention that you use Mint, you will definitely get this reply. "This issue is best handled on the Mint forums". Using the previous nano bug example, it's possible that Mint's programmers modified nano to make it run better in their distribution. If they do make a mistake, they will want to know about it and, after making it, they will be the ones to fix it.

Once fixed, the updated program will be put into a repository that you can use. When you get updated, it will flow down to you, like this:

◈ If the publisher makes a fix, the new version will be available in the release repository.

◈ If the app's programmer makes a fix, it will be sent to the publisher who tests the new code. Once it is found to be working properly, it is placed in a warehouse and flowed downstream.

Automatically flow downstream

There was a time when users had to get updates themselves. Users get updated source code and compile a new executable file. Over time, tools like apt were created that allowed users to extract updated binaries (executables) from software repositories. apt The program is Debian's, but other distributions have their own similar programs for this purpose.

A program like apt handles the upstream/downstream work. If you run apt with the upgrade option, like this:

sudo apt upgrade

It will look at the (upstream) release repository, find any needed update packages, and pull them to your machine (downstream) and install them.

Some distributions will go further. Distro programmers and maintainers are always checking their products. Many times, application programmers make improvements to their programs. System libraries will be updated frequently, security holes will be plugged, and so on. These updates are provided to the publisher, who then makes the new version available in the release repository.

Rather than asking you to run apt every day, some distributions will alert you that updates are available and ask you if you want them. If you want it, just accept and the update will be sent to your machine and installed.

Summarize

Upstream and downstream are actually just the directions of data flow. How this data flows upstream or downstream depends on who ultimately needs to process it. Basically, programmers are upstream and users are downstream.

Again, as users, we really don't need to care about these terms, but these concepts do help in the development and maintenance of software. Duplication of effort is avoided by directing work to the appropriate group. This also ensures standard maintenance. For example, Chrome may need to make some minor changes to run on a certain distribution, but at its core it's Chrome and there won't be any major changes to how it looks or behaves.

If you find a bug in any program in your distribution, simply report it to the maintainer of the distribution, usually through their website. You're going to send it upstream, but it doesn't matter whether you remember that you're sending the report upstream.

The above is the detailed content of Linux slang explained: What are upstream and downstream?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:lxlinux.net. If there is any infringement, please contact admin@php.cn delete