## 3 Scenarios of Multi-Level Buffering Services and Performance Evaluations  
The architecture of the proposed scheme capable of providing multi-service buffering is shown in Figure 5. In this scenario, two packets competing for a common output port are considered. At the buffer input ports, packets carrying CMLS signals are decoded by decoder arrays to generate photocurrents with amplitudes that are proportional to the power variations of the optical payloads. By considering the CMLSs that had been occupied by the existing optical packets in the buffer, the control unit decides which new sequences will be used to encode the incoming packets waiting to be queued. To perform optical encoding, an electrical switch forwards the baseband-decoded signals to optical modulators, and then the optical carriers are sent to the corresponding encoders. Please note that in this case, a packet carrying \(C_{(1,1)}(21)\) has existed in the buffer, so the identical sequence carried by the input packet is switched into another available code \(C_{(3,1)}(21)\). The other input packet retains its code \(C_{(2,1)}(21)\) since it is not used by any queued packets. After renewing the attached codes, the encoded packets of different CMLSs are combined and passed to the output port. The use of CMLS codes in encoding packets provides the buffering service with variable performance. The partition of code set \(C_{(i,j)}(21)\) for high-QoS users is shown in Figure 6a, where seven subsets \(C(i,1)\), \(C(i,2)\),..., \(C(i,7)\) are obtained, and each of them has three CMLS codes with a common index \(i\). For high-QoS users, the preferred scenario is to partition the CMLS code set into \(\max\{N_{1}^{\text{M}},\)\(N_{2}^{\text{M}}\}\) subsets. In the example of \(N_{1}^{\text{M}}\) = 3 and \(N_{2}^{\text{M}}\) = 7, seven code subsets are obtained. If the codes in a certain subset are all occupied, the newly incoming packets with the codes in the same group will be sent to a free encoder generating a CMLS of different \(i\). Figure 6b shows the encoder implementation corresponding to the code distribution in Figure 6a. The connection to the input ports of the upper  
Figure 4: The decoder architecture of CMLS \(C_{(1,1)}(21)\) based on AWG. Mux: Multiplexer. PD: Photodetector. Figure 5: The optical buffering architecture with optical encoding/decoding of the CMLS. ODA: optical decoder array; OEA: optical encoder array; E/O: electrical-to-optical conversion. 3 AWG is varied, and the one to the 1 st input port of the lower \(7\times 7\) AWG is fixed to construct the code subset C(_i_,1), where \(1\leq i\leq 3\). Another subset C(_i_,2) can be obtained by establishing the link to the 2 nd input of the lower AWG. The other code distribution for low-QoS users is depicted in Figure 7a. The code set is divided into three subsets, C(1,_j_), C(2,_j_), and C(3,_j_). Each subset has seven CMLS codes. If the codes in a specific subset are assigned to the queued packets, the incoming packet is encoded with an available code signal with a different index \(j\). Figure 7b shows the encoding process based on AWGs for low-QoS users. To distribute the codes in C(1,_j_), the link to the upper AWG is given while the one to the lower AWG is changing. In a buffering system based on a CMLS, \(N\) is the maximum number of available codes. These codes are used for queuing packets when they arrive at the buffer. If the system is at capacity, an incoming signal is blocked and dropped. The buffering procedures can be described as a queue system where the AWG encoder is the single server, and the packet flow is the data source. The inter-arrival time \(\mu\) between the two successive input packets is assumed to be the formula of the exponential  
Figure 6: The optical buffering scenario for high quality-of-service (QoS) packets. (**a**) Code partition method; (**b**) encoder setup. Figure 7: The optical buffering scenario for low-QoS packets. (**a**) Code partition method; (**b**) encoder setup. process.