0% found this document useful (0 votes)
28 views19 pages

Comparison of Static and Dynamic Data Structure

Uploaded by

Lasya BTS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views19 pages

Comparison of Static and Dynamic Data Structure

Uploaded by

Lasya BTS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Comparison of Static and dynamic data structure

Dynamic Static

• Memory is allocated to the data • Memory is allocated at compile time.


structure dynamically.
• Is predefined and
• ie. Run time.
• never change during run time also.
• Used stack implementation
Used stack implementation using
using linked list.
array
Comparison of Static and dynamic data
structure

Dynamic-advantages Static-Advantages
• Makes the most efficient use of • The memory allocation is fixed.
RAM as it uses as much memory No problems to adding and
as it needs. removing data items.
• Easier to program .. There is no
• One does not need to know need to check upon the data
decide upon the size of the data structure size.
structure in advance. • Space reserved in RAM will be
available.
Comparison of Static and dynamic data
structure
Dynamic-Disadvantages Static-Disadvantages
• Memory allocation is dynamic-> • Insufficient memory .because
Overflow. Allow to limit exceed predefined.
and underflow it become empty.
• Difficult predict the required
• Dynamic data are slower during array size.
execution.
• Random access is allowed and
elements should be visited
sequentially.
Batch Processing
• Batch Processing system is an efficient way of processing large
volumes of data.
• Batch processing can handle large data volumes effectively and
produce timely results.
• Some programs are batched together and then executed as a group,
without the need of any intervention from the user. Only one program
is actually running at a time. While other are waiting for their turn .
When it completes, the next program in the queue runs and so on.
Until all the program in the batch are run.
Multiprogramming
• More than one program could be loaded in the main memory at a
same time ready to execute. Only one program will actually be
executed by the CPU at any one point in time. All the other programs
will be waiting for their turn.
Multitasking
• Multitasking refers to the ability of an operating system to handle
multiple tasks (processes) at the same time.

• There are two types of multitasking: preemptive and cooperative.


• In preemptive multitasking, the operating system decides when a task
should run.
• In cooperative multitasking, tasks voluntarily give up control of the
CPU to allow other tasks to run.
Multithreading
• Multithreading is a technique where a single program (process) can
perform multiple tasks (threads) simultaneously.
resource leak
• A resource leak occurs when a computer program incorrectly
manages resources by failing to release them after use.

• This can lead to reduced performance and, in severe cases, system


crashes or resource exhaustion.

• Common types of resource leaks include memory leaks, file descriptor


leaks, and handle leaks.
Swapping
• In which a process or blocks of program code can be swapped
temporarily out of RAM and into a hard disk, and then later brought
back into RAM to continue their execution.
Paging
• Paging is widely used in modern operating systems to manage
memory efficiently, providing flexibility and ensuring that physical
memory is used optimally.

• Paging is a memory management scheme that eliminates the need for


contiguous allocation of physical memory. It divides the process's
virtual memory into fixed-size blocks called pages and the physical
memory into blocks of the same size called frames.
Slicing
• Time slicing is a scheduling mechanism used in multitasking operating
systems where the CPU's time is divided into small units called time
slices.
Preemptive scheduling
• Preemptive scheduling is commonly used in multitasking .

• TO ensure that high-priority tasks get the CPU time they need
promptly.

• When high priority takes over from the lower priority task currently
running.
Common Preemptive Scheduling
Algorithms
• 1. FIRST COME FIRST SERVE SCHEDULING (FCFS)
• 2. SHORTEST JOB FIRST SCHEDULING (SJF)
• 3. Priority scheduling
• 4. ROUND ROBIN Scheduling
• 5. Multilevel Queue Scheduling.
• 6. Multilevel Feedback queue scheduling.
First Come First Serve
Scheduling (FCFS)
• First Come First Serve Scheduling (FCFS):
• Description: Processes are executed in the order they arrive in the
ready queue.
• Advantages: Simple to implement.
Shortest Job First Scheduling
(SJF):

•Description: The process with the shortest execution time is selected next.

•Advantages: Minimizes average waiting time.

•Disadvantages: Difficult to predict the length of the next CPU


Priority Scheduling:

• Priority Scheduling:
• Description: Processes are assigned priorities, and the CPU is
allocated to the process with the highest priority.
• Advantages: Ensures important processes are executed first.
• Disadvantages: Lower priority processes may suffer from starvation.
Round Robin Scheduling:

• Round Robin Scheduling:


• Description: Each process is assigned a fixed time slice in a cyclic
order.
• Advantages: Fair to all processes; good for time-sharing systems.
• Disadvantages: Can have high overhead due to frequent context
switching; average waiting time can be long.
Multilevel Queue Scheduling:

• Multilevel Queue Scheduling:


• Description: Processes are divided into different queues based on
their priority or type, each with its own scheduling algorithm.
• Advantages: Flexible and can be tailored to different types of
processes.
• Disadvantages: Complex to implement; requires managing multiple
queues.
Multilevel Feedback Queue
Scheduling:
• Multilevel Feedback Queue Scheduling:
• Description: Similar to multilevel queue scheduling, but processes can
move between queues based on their behavior and age.
• Advantages: More flexible and adaptive than multilevel queue
scheduling; can prevent starvation.

You might also like