
シリアル番号 ( 英 : Serial number )は、ある決まった離散的整数値によって個々の識別をするために割り当てられる一連のユニークな数である。 Serial Number (English: Serial number), the total value of the integer and discrete decision in each series is assigned a unique number in order to identify. 典型的用法が拡大され、オブジェクトの大きな集合の元を識別する数値や文字列だけでなく、 情報工学におけるデータ処理での識別に使われるようになった。 Typical usage is larger, as well as strings and numbers to identify the source of a large set of objects, were to be used for identification in data processing in computer science. 数値的識別子が全てシリアル番号というわけではなく、シリアル番号ではない識別番号をnominal number (名目番号)と呼ぶ。 Not all serial numbers of the numerical identifier, the serial number is an identification number without nominal number (nominal number) call.
シリアル番号は通常、負の値はとらず、1 または 0 から始まる。 Serial number usually takes no negative values, starting with 0 or 1.
目次 Contents |
何らかの製品にシリアル番号が付与されていて、それが連続な番号である場合、 n個のサンプルをとることでベイズ推定や最尤法をつかった大雑把な総数の推定が可能である[1] 。 They have been given a serial number for any product, if it is a continuous number, n is possible to estimate the total number is roughly the maximum likelihood and Bayesian soaked by taking a sample of the total [1].
シリアル番号は通信プロトコルでよく使われ、シーケンス番号などと呼ばれる。 Serial numbers are often used in protocol communication, and called the sequence number. これは、パケットの順序を確定するために必須である。 This is essential to determine the order of the packets. しかし、シーケンス番号に割り当てられるビット数は固定であり、一巡すると再度最初から番号が再利用される。 However, the number of bits allocated to the sequence number is fixed and used again and again from the beginning to round numbers. 従って、最近割り当てられたシリアル番号とずっと以前に割り当てられたシリアル番号が同じということになる。 Therefore, the same as the serial number will be assigned a serial number assigned to long ago and recently. このようなシーケンス番号の曖昧さによる問題を防ぐため、 RFC 1982 (Serial Number Arithmetic)では、この種のシリアル番号を使った計算に関する特別なルールを定義している。 To avoid the problems caused by the vagueness of such a sequence number, RFC 1982 (Serial Number Arithmetic) provides special rules are defined using the serial number of this type of calculation.
一部のプロトコルは問題を無視し、単にシリアル番号として大きな整数を使い、問題が発生する前に技術が廃れるだろうと見なしている( 2000年問題参照)。 Some protocols will ignore the problem, simply use a large integer as a serial number that will die out and considered before the technology problems (see issue 2000 years).
ここでは、シーケンス番号に小さな正の整数を加算することと、シーケンス番号同士の比較について解説する。 In this section, and adding the integer sequence of small positive number that describes the comparison between the sequence numbers. 符号なしの実装だけを扱い、ビット数は RFC と同様 "SERIAL_BITS" で表す。 Implementation only handles unsigned, as the RFC number of bits "SERIAL_BITS" represent.
シーケンス番号への整数の加算は、単純な符号なしの整数の加算の後で、符号なしの剰余演算を行って加算結果を範囲内に収める(一般にCPUの符号なしの加算命令では自動的にそのような演算が行われる)。 Integer addition to the sequence number, after the addition of a simple unsigned integer, the results fit within the range we add the unsigned remainder operation (typically CPU at no additional instruction will automatically sign Such calculations are performed).
s' = (s + n) modulo (2 ^ SERIAL_BITS) s' = (s + n) modulo (2 ^ SERIAL_BITS)
以下の範囲外の値の加算は未定義である。 Outside the scope of the following added value is undefined.
[0 .. (2 ^(SERIAL_BITS - 1) - 1)] [0 .. (2 ^ (SERIAL_BITS - 1) - 1)]
基本的に、加算結果がこの範囲外であれば「丸め」が発生し、結果としてシーケンス番号は元の値より小さくなる。 Basically, if the addition result is outside this range "rounding" occurs, and as a result of the sequence number is smaller than the original.
2つのシーケンス番号 i1 と i2(シーケンス番号 s1 と s2 の符号なし整数表現)の比較方法を以下に示す。 I1 sequence number one and two of i2 (sequence number unsigned integer representation of s1 and s2) are shown below for comparison.
等しいかどうかの比較は通常の数値の比較と変わらない。 Comparison of equality is no different from the usual numerical comparison. 大小比較のアルゴリズムは複雑であり、一方のシーケンス番号が値の範囲の限界付近の場合を考慮して「丸められた」小さい値を実際には大きい値と判断しなければならない。 Size comparison algorithm is complex, if you consider the range of values near the limit of a sequence number one "rounded" is actually a lower value should be considered greater. つまり、s1 が s2 より小さいと見なされるのは、以下の場合である。 That, s1 and s2, are considered less than is the case below.
(i1 < i2 and i2 - i1 < 2^(SERIAL_BITS - 1)) or (i1 <i2 and i2 - i1 <2 ^ (SERIAL_BITS - 1)) or (i1 > i2 and i1 - i2 > 2^(SERIAL_BITS - 1)) (i1> i2 and i1 - i2> 2 ^ (SERIAL_BITS - 1))
同様に、以下の場合に s1 は s2 より大きいと見なされる。 Similarly, if: s1 is considered to be greater than s2.
(i1 < i2 and i2 - i1 > 2^(SERIAL_BITS - 1)) or (i1 <i2 and i2 - i1> 2 ^ (SERIAL_BITS - 1)) or (i1 > i2 and i1 - i2 < 2^(SERIAL_BITS - 1)) (i1> i2 and i1 - i2 <2 ^ (SERIAL_BITS - 1))
このアルゴリズムにはいくつか問題がある。 This algorithm has some problems. まず、数値によっては大小比較結果が定義されないことになる。 First, the numbers will not be defined by the size comparison. アルゴリズムの実装は各種組織が独立して行っているため、そのような問題の発生を防ぐことは不可能に近い。 Algorithm has been implemented for various independent organizations, to prevent the occurrence of such problems is nearly impossible.
RFC 1982では以下のように書いている: RFC 1982 is written as below:
