ArticleslgStudy

science

Online codes

Online codes is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Online codes rather than just read about it. In short: In computer science, online codes are an example of rateless erasure codes. These codes can encode a message into a number of symbols such that knowledge of any fraction of them allows one to recover the original message (with high probability).

Online codes — main illustration
Online codes — illustration

Key takeaways

  • Online codes belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Online codes to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Online codes from memory before moving on to harder problems.

Reference excerpt

In computer science, online codes are an example of rateless erasure codes. These codes can encode a message into a number of symbols such that knowledge of any fraction of them allows one to recover the original message (with high probability). Rateless codes produce an arbitrarily large number of symbols which can be broadcast until the receivers have enough symbols.

The online encoding algorithm consists of several phases. First the message is split into n fixed size message blocks. Then the outer encoding is an erasure code which produces auxiliary blocks that are appended to the message blocks to form a composite message. From this the inner encoding generates check blocks. Upon receiving a certain number of check blocks some fraction of the composite message can be recovered. Once enough has been recovered the outer decoding can be used to recover the original message.

Detailed discussion Online codes are parameterised by the block size and two scalars, q and ε. The authors suggest q=3 and ε=0.01. These parameters set the balance between the complexity and performance of the encoding. A message of n blocks can be recovered, with high probability, from (1+3ε)n check blocks. The probability of failure is (ε/2)q+1.

Outer encoding Any erasure code may be used as the outer encoding, but the author of online codes suggest the following. For each message block, pseudo-randomly choose q auxiliary blocks (from a total of 0.55qεn auxiliary blocks) to attach it to. Each auxiliary block is then the XOR of all the message blocks which have been attached to it.

Inner encoding

The inner encoding takes the composite message and generates a stream of check blocks. A check block is the XOR of all the blocks from the composite message that it is attached to. The degree of a check block is the number of blocks that it is attached to. The degree is determined by sampling a random distribution, p, which is defined as:

F = ⌈ ln ⁡ ( ϵ 2 / 4 ) ln ⁡ ( 1 − ϵ / 2 ) ⌉ {\displaystyle F=\left\lceil {\frac {\ln(\epsilon ^{2}/4)}{\ln(1-\epsilon /2)}}\right\rceil }

p 1 = 1 − 1 + 1 / F 1 + ϵ {\displaystyle p_{1}=1-{\frac {1+1/F}{1+\epsilon }}}

p i = ( 1 − p 1 ) F ( F − 1 ) i ( i − 1 ) {\displaystyle p_{i}={\frac {(1-p_{1})F}{(F-1)i(i-1)}}} for 2 ≤ i ≤ F {\displaystyle 2\leq i\leq F}

Once the degree of the check block is known, the blocks from the composite message which it is attached to are chosen uniformly.

Decoding Obviously the decoder of the inner stage must hold check blocks which it cannot currently decode. A check block can only be decoded when all but one of the blocks which it is attached to are known. The graph to the left shows the progress of an inner decoder. The x-axis plots the number of check blocks received and the dashed line shows the number of check blocks which cannot currently be used. This climbs almost linearly at first as many check blocks with degree > 1 are received but unusable. At a certain point, some of the check blocks are suddenly usable, resolving more blocks which then causes more check blocks to be usable. Very quickly the whole file can be decoded. As the graph also shows the inner decoder falls just shy of decoding everything for a little while after having received n check blocks. The outer encoding ensures that a few elusive blocks from the inner decoder are not an issue, as the file can be recovered without them.

External links Original paper Rateless Codes and Big Downloads (A more accessible paper by the same author) Papers by Petar Maymounkov A Ruby project hosted at RubyForge containing a Ruby library for Online Coding Archived 2016-03-03 at the Wayback Machine

Illustrations

Online codes: High level view of the use of online codes
High level view of the use of online codes
Online codes: A graph of check blocks received against number of message blocks fixed for a 10000 block message.
A graph of check blocks received against number of message blocks fixed for a 10000 block message.

Worked examples

Example 1 — a first encounter with Online codes

Start with the simplest possible case. Write down what Online codes claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Online codes before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Online codes ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Online codes

In research
Online codes appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Online codes in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Online codes is common in secondary-school and first-year university syllabi. It links to neighbouring topics Coding theory, so understanding it makes those chapters shorter.
In everyday life
Look for Online codes outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Online codes in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Online codes means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Online codes out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Online codes in simple terms?

In computer science, online codes are an example of rateless erasure codes. These codes can encode a message into a number of symbols such that knowledge of any fraction of them allows one to recover the original message (with high probability).

Why does Online codes matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Online codes?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Online codes.

Tags

  • Coding theory

Keep exploring