answersLogoWhite

0


Best Answer

In C Programming arrays are given a size, which is the number of elements in the array. Space is allocated for an array in memory. The is the only memory that the array is supposed to use. C is a programming language that has very little restrictions regarding what it will allow you to do. If you try to write to a memory location that is not supposed to be written over, C will let you, however sometimes the operating system will prevent this. When an array writes past where it is supposed to this is called array overflow. For example. If is an array is designed to hold 50 integers and the program adds 51 integers then the extra integer is written at the end of the array and had to be written in memory not designated for the array.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

stack overflow occurs when the on--chip stack capacity is exceeded. This can be detected by a comparison of the top-pointer, the last-pointer and the index specified for a create-frame operation ( for push). Initially the top-pointer is set to 1 and the last-pointer to 0, placing a dummy element on the stack.

If an index specified for a read access is greater than the number of valid on--chip stack elements, a stack underflow occurs

Read more: Overflow_and_underflow_conditions_in_data_structures

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

Overflow occurs when the program writes data to memory locations beyond the space that has been allocated for the data, either on the stack or the heap. This can cause unpredictable and inconsistent program behavior.

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

Buffer overflow and buffer underflow are similar but opposing problems.

Buffer overflow (also known as buffer overrun) occurs when one device (or process) transmits data to another device faster than the receiving device can process it. Buffers are often allocated using an array with fixed length but when a transmitting device attempts to send more data than will fit in this array, an overflow occurs which results in undefined behaviour. To prevent this, the receiving device must interrupt the transmitting device each time the buffer is filled.

Buffer underflow (also known as buffer underrun) is the opposite, where the receiving device can process data faster than the transmitting device can provide it, forcing the receiving device to pause while the buffer is filled. A typical example is when burning a CD. If the source data is held up by another task taking control of the source media, the write buffer may be depleted before the transmitting device regains control of the media, resulting in gaps upon the CD. If the gaps are too large, the CD becomes unreadable. Modern CD-ROM drives include buffer underrun technology that can stop and restart writing whenever an underrun occurs, thereby ensuring gap sizes are within the accepted tolerance. Nevertheless, when an underrun occurs, the integrity of the data could be compromised.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is overflow and underflow in queue?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Why an operation to check queue overflow is not implemented on linked queue?

In linked queue we're dynamically allocating the memory and there's no fixed memory limit in Linked Queue. That's why there's no operation for overflow. I guess It's the correct reason


Algorithm to insert and delete an element from a circular queue?

The Method To Add an element in Circular Queue # define MAXQUEUE 100 struct queue{ int items[MAXQUEUE]; int front, rear; } struct queue q; q.front=q.rear=MAXQUEUE -1; void ENQ(struct queue *pq, int x) { /* make room for new element*/ if(pq ->rear = MAXQUEUE - 1) pq-> rear = 0; else (pq->rear)++; /* check for overflow */ if(pq ->rear==pq->front) { printf("queue overflow); exit(1); } pq->items[pq->rear]=x; return; }/* end of ENQ*/ A Method to Delete an element from Circular Queue int DQ(struct queue *pq) { if(pq-> rear == pq-> front) { printf("queue underflow"); exit(1); }/*end if*/ if(pq->front = = MAXQUEUE-1) pq->front=0; else (pq->front)++; return(pq->items[pq->front]);


What is the condition for the overflow in the linked lists?

In linked list if there is no any element inside it than we can say linked list is underflow.


What is meant by overflow in a digital circuit?

A overflow is a condition in which a calculation produces a unit of data too large to be stored in the location alloted to it. An overlow cannot happen when two numbers of opposite sign are added. An overflow may occur in an addition of binary numbers if the augend and addend are both positive or negative.


What is difference between job queue and ready queue?

Ready queue contain all the jobs that are ready to execute.so the job queue and the ready queue are one and the same.

Related questions

What are some common errors detected by the CPU?

Fixed point overflow, Floating point overflow, Floating point underflow, etc.


Algorithm to delete elements at both ends in a dequeue?

Delete Front---- DQDELETE_FRONT(QUEUE, FRONT, REAR, ITEM) 1. [check for queue underflow] If FRONT<0, Then: Print: "Queue is empty", and Return. 2. ITEM = QUEUE[FRONT]; 3. Set FRONT = FRONT + 1. 4. Return. Delete Rear---- DQDELETE_REAR(QUEUE, REAR, FRONT, ITEM) 1. [check for queue underflow] If REAR<0, Then: Print: "Queue is empty", and Return. 2. ITEM = QUEUE[REAR]. 3. Set REAR = REAR - 1. 4.Return.


Why an operation to check queue overflow is not implemented on linked queue?

In linked queue we're dynamically allocating the memory and there's no fixed memory limit in Linked Queue. That's why there's no operation for overflow. I guess It's the correct reason


Algorithm to insert and delete an element from a circular queue?

The Method To Add an element in Circular Queue # define MAXQUEUE 100 struct queue{ int items[MAXQUEUE]; int front, rear; } struct queue q; q.front=q.rear=MAXQUEUE -1; void ENQ(struct queue *pq, int x) { /* make room for new element*/ if(pq ->rear = MAXQUEUE - 1) pq-> rear = 0; else (pq->rear)++; /* check for overflow */ if(pq ->rear==pq->front) { printf("queue overflow); exit(1); } pq->items[pq->rear]=x; return; }/* end of ENQ*/ A Method to Delete an element from Circular Queue int DQ(struct queue *pq) { if(pq-> rear == pq-> front) { printf("queue underflow"); exit(1); }/*end if*/ if(pq->front = = MAXQUEUE-1) pq->front=0; else (pq->front)++; return(pq->items[pq->front]);


What is the condition for the overflow in the linked lists?

In linked list if there is no any element inside it than we can say linked list is underflow.


What is meant by overflow in a digital circuit?

A overflow is a condition in which a calculation produces a unit of data too large to be stored in the location alloted to it. An overlow cannot happen when two numbers of opposite sign are added. An overflow may occur in an addition of binary numbers if the augend and addend are both positive or negative.


What would result in an overflow?

An overflow occurs when you attempt a mathematical operation that results in a number that cannot be stored in the variable type you are using. C# projects only check for overflows if you have explicitly configured the project to do so (because it slighly slows down your application). To do this, you have to go into the Project Properties page, Build tab, click Advanced, and then choose "Check for arithmetic overflow/underflow" If you set this option, then this code, which attempts to add 1 to a integer that is already at the maximum value that the 32-bit integer type can hold, would cause an overflow: int a = int.MaxValue; a++;


What is the meaning of a stack overflow?

A stack overflow is a programming term used to identify when a function tries to access memory from a stack that does not exist. A stack, such as a queue or array, contains a limited number of memory spaces set aside when it is created. For example, if an array has 8 objects in it and a function tried to access an item at slot nine, which doesn't exist, it would cause a stack overflow.


What are types of Queue?

Queue is a data structure which is based on FIFO that is first in first out. Following are the types of queue: Linear queue Circular queue Priority queue Double ended queue ( or deque )


Which queue most efficient queue using array?

circular queue


What is difference between job queue and ready queue?

Ready queue contain all the jobs that are ready to execute.so the job queue and the ready queue are one and the same.


Queue in a sentence?

He added the download to the queue.(Line)I saw a queue in the park(waiting line)