Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c) Consider the following problem: you have implemented a ring buffer to store some incoming data. You are using an array of 56 bytes, and

c) Consider the following problem: you have implemented a ring buffer to store some incoming data.

You are using an array of 56 bytes, and each item of data is 8 bytes long.

To add data you are using the following pseudo-code:

for j=0 to 7:

buffer[i + j] = newData[j]

i = (i + 8) % 56

Later, the data specification has changed to 9 bytes long, so you change your code as follows

for j=0 to 8:

buffer[i + j] = newData[j]

i = (i + 9) % 56

but the program is producing garbage. Explain what has gone wrong. (1 mark)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

More Books

Students also viewed these Databases questions

Question

What teacher supports and services are needed? (D2, D7, D8)

Answered: 1 week ago