Recent Feedback
6) Describe the purpose of a buffer and give an example from your own experience where its use clearly benefits system response. 7) Rewrite each of the following arithmetic expressions to take advantage of concurrent processing and then code each? use the terms COBEGIN and COEND to delimit the sections of concurrent code. a. A + B * R * Z - N * M + C² b. ( X * ( Y * Z * W * R ) + M + N + P ) c. ( ( J + K * L * M * N ) * I )
6) Describe the purpose of a buffer and give an example from your own experience where its use clearly benefits system response. Purpose of a buffer: Buffers are used whenever data is received in sizes that may be different than the ideal size for the hardware or software that uses the buffer. For example, a 64-bit processor on a 16-bit bus may have a buffer to hold 16-bit requests until they equal 64-bits. Another use of buffers is to keep hardware from getting overwhelmed with information. In that scenario, you use a large buffer to hold data until a device or program is ready to receive it, instead of just pushing it onto a device that might not be ready. Buffers must be optimized in size to work efficiently for the purpose they are designed. An example from your own experience: When letters are typed on keybaord in MS DOS program (Like a command prompt), these are line buffered until carriage return is pressed. The keyboard buffer stores the data temporarily and this data is transferred to the input output controller when it has a meaning. This increases the responsiveness of the command prompt. If there is no keyboard buffer, the over all responsiveness would be decreased. As each letter would be passed to controlller for processing and the control would revert back to keyboard involving overheads. 7) Rewrite each of the following arithmetic expressions to take advantage of concurrent processing and then code each? use the terms COBEGIN and COEND to delimit the sections of concurrent code. a. A + B * R * Z - N * M + C² COBEGIN T1 = B*R*Z T2=N*M T3 = C*C COEND T4=A+T1 T5 = T2+T3 ANS = T4-T5 b. ( X * ( Y * Z * W * R ) + M + N + P ) COBEGIN T1 = Y*Z T2 = W*R T3 = M+N COEND COBEGIN T4 = T1*T2 T5 = P+T3 COEND T6 = X*T4 ANS = T6+T5 c. ( ( J + K * L * M * N ) * I ) COBEGIN T1 = K*L T2 = M*N COEND T3 = T1*T2 T4 = J+T3 ANS = T4*IComputer'sGuru40241.1942318634
Experience: Computer Engineer with lots of knowledge and skills
Is there anyway to explain how you came up with the answers for question 7 a- c? I want to actually learn in the process :) Thanks!
Hi, First modify and correct 7a to a. A + B * R * Z - N * M + C² COBEGIN T1 = B*R T2=N*M T3 = C*C COEND T4=T1*Z T5=T4+A T6 = T2+T3 ANS = T5-T6 Everything else is fine it is simple, you need to find out the operations which are not dependant on other. e.g. in a. A + B * R * Z - N * M + C² we can decompose the operations on the basis of precedence as follows (A) + (B * R * Z) - (N * M) + C² (A) + ((B * R) * Z) - (N * M) + (C*C) Now the operand in parenthesis can be operated parallely There are three such sets (B * R), (N * M) and (C*C) ((B * R) * Z) cannot be proccessed parallely as product of ((B * R) * Z) depands on the product of (B * R) Process these three parallely as COBEGIN T1 = B*R T2=N*M T3 = C*C COEND Store their results in temporary variables T1, T2, T3 perform aother calculation sequentially as they depand on each other (The output of one becomes the input of another) T4=T1*Z T5=T4+A T6 = T2+T3 ANS = T5-T6 Computer'sGuru40241.2450621875