We have been working very hard since 2009 to facilitate in learning Read More. We can't keep up without your support. Donate.

"Discuss different usage scenarios of queue, stack and heap data structures in Operating Systems, also explain why not only one among them is used?"

Views: 199

Replies to This Discussion

Please Discuss here about this GDB.Thanks
plzz help thx....
yar koi hai jo GDB load kary ga plz yar/
Out of the numerous uses of the queues, one of the most useful is simulation. A simulation program attempts to model a real-world phenomenon. Many popular video games are simulations, e.g., SimCity, Flight Simulator etc. Each object and action in the simulation has a counterpart in the real world. Computer simulation is very powerful tool and it is used in different high tech industries, especially in engineering projects. For example, it is used in aero plane manufacturing. Actually Computer Simulation is full-fledged subject of Computer Science and contains very complex Mathematics, sometimes. For example, simulation of computer networks, traffic networks etc.
A customer enters the bank at a specific time (t1) desiring to conduct a transaction.
Any one of the four tellers can attend to the customer. The transaction (withdraws, deposit) will take a certain period of time (t2). If a teller is free, the teller can process the customer’s transaction immediately and the customer leaves the bank at t1+ t2. It is possible that none of the four tellers is free in which case there is a line of customers at each teller. An arriving customer proceeds to the back of the shortest line and waits for his turn. The customer leaves the bank at t2 time units after reaching the front of the line.
The time spent at the bank is t2 plus time waiting in line.
So what we want to simulate is the working environment of the bank that there are
are serving customers one by one. A customer has to wait for a certain period of time before he gets served and by using simulation tool, we want to know the average waiting time of a bank customer. We will talk about this simulation in the next lecture and will do coding also in order to understand it well.


gdb should contains definitions and their work in operating system

 

Usage scenario of queue: The operations of inserting and removing can
be done through enqueue and dequeue repectively. A queue is a linear
data structure into which items can only be inserted at one end and
removed from the other. In contrast to the stack, which is a LIFO (Last In
First Out) structure, a queue is a FIFO (First In First Out) structure.
(PAGE 87)
“Stack is a collection of elements arranged in a linear order”
Usage scenario of Stack:We saw the use of stack when a function is called
by value, by reference or by pointer. The arguments passed to the function
and local variables are pushed on to the stack. We know that function
calls are made with the help of stacks.stack structure are used in infix,
prefix and postfix expressions
Usage scenario of Heap:The major use of heap is in priority queues.
Priority queues are not FIFO or LIFO. The elements are taken out on
some key value, also known as priority value.(PAGE 362)
(b) part
the implementation of priority queue with an array is not efficient in terms
of time.There is an alternate that is called heap. The use of priority queue
with the help of heap is a major application.We can not use any one of
these three data structures in all situations.. In queue we can dequeue the
items from other end but in the stack can not. Queue takes much space as
compare to stack and heap but heap is efficient data structure than both
others.

RSS

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service