nc (*size of consumer block* (*buffer sizecommon multipe of np and nc*var nenfintegerinoutintegernonfullsignals signal(*ne > *nonemptysignals signal(*nf > *bufarray of charprocedure deposit (var xarray of char)begin ne :ne npif ne then signals wait(nonfullendfor : to np- do buf[in: [ ]inc(inendif in then in : endnf :nf npif nf > then signals send(nonemptyend end depositprocedure fetch (var xarray of char)begin nf :nf ncif nf then signals wait(nonemptyendfor : to nc- do [ :buf[out]inc(outendif out then out : endne :ne ncif ne > then signals send(nonfullend end fetchbegin ne :nnf : in : out : signals init(nonfull)signals init(nonemptyend buffer textual input and output by standard input and output we understand the transfer of data to (froma computer system from (togenuinely external agentsin particular its human operator input may typically originate at keyboard and output may sink into display screen in any caseits characteristic is that it is readableand it typically consists of sequence of characters it is text this readability condition is responsible for yet another complication incurred in most genuine input and output operations apart from the actual data transferthey also involve transformation of representation for examplenumbersusually considered as atomic units and represented in binary formneed be transformed into readabledecimal notation structures need to be represented in suitable layoutwhose generation is called formatting whatever the transformation may bethe concept of the sequence is once again instrumental for considerable simplification of the task the key is the observation thatif the data set can be considered as sequence of charactersthe transformation of the sequence can be implemented as sequence of (identicaltransformations of elements (we shall briefly investigate the necessary operations for transforming representations of natural numbers for input and output the basis is that number represented by the sequence of decimal digits <dn- has the value sii - di