0% found this document useful (0 votes)
4 views4 pages

Operating System Notes

The document outlines an experiment to simulate MVT (Multiprogramming with a Variable number of Tasks) and MFT (Multiprogramming with a Fixed number of Tasks) memory management techniques using C programming. MFT partitions memory into fixed sizes leading to internal fragmentation, while MVT allocates memory dynamically, which can result in external fragmentation. The document includes example code and input/output scenarios for both techniques.

Uploaded by

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

Operating System Notes

The document outlines an experiment to simulate MVT (Multiprogramming with a Variable number of Tasks) and MFT (Multiprogramming with a Fixed number of Tasks) memory management techniques using C programming. MFT partitions memory into fixed sizes leading to internal fragmentation, while MVT allocates memory dynamically, which can result in external fragmentation. The document includes example code and input/output scenarios for both techniques.

Uploaded by

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

OS

Thursday, 8 September 2016

MVT and MFT memory management techniques


EXPERIMENT
OBJECTIVE
Write a C program to simulate the MVT and MFT memory
management techniques
DESCRIPTION
 MFT (Multiprogramming with a Fixed number of Tasks) is one of the
old memory management techniques in which the memory is partitioned into
fixed size partitions and each job is assigned to a partition. The memory
assigned to a partition does not change.
 MVT (Multiprogramming with a Variable number of Tasks) is the
memory management technique in which each job gets just the amount of
memory it needs. That is, the partitioning of memory is dynamic and changes
as jobs enter and leave the system. MVT is a more ``efficient'' user of
resources. MFT suffers with the problem of internal fragmentation and MVT
suffers with external fragmentation.
PROGRAM
MFT MEMORY MANAGEMENT TECHNIQUE
#include<stdio.h>
#include<conio.h>
main()
{
int ms, bs, nob, ef,n, mp[10],tif=0;
int i,p=0;
clrscr();
printf("Enter the total memory available (in Bytes) -- ");
scanf("%d",&ms);
printf("Enter the block size (in Bytes) -- ");
scanf("%d", &bs);
nob=ms/bs;
ef=ms - nob*bs;
printf("\nEnter the number of processes -- ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter memory required for process %d (in Bytes)-- ",i+1);
scanf("%d",&mp[i]);
}
printf("\nNo. of Blocks available in memory -- %d",nob);
printf("\n\nPROCESS\tMEMORY REQUIRED\t ALLOCATED\tINTERNAL
FRAGMENTATION");
for(i=0;i<n && p<nob;i++)
{
printf("\n %d\t\t%d",i+1,mp[i]);
if(mp[i] > bs)
printf("\t\tNO\t\t---");
else
{
printf("\t\tYES\t%d",bs-mp[i]);
tif = tif + bs-mp[i];
p++;
}
}
if(i<n)
printf("\nMemory is Full, Remaining Processes cannot be accomodated");
printf("\n\nTotal Internal Fragmentation is %d",tif);
printf("\nTotal External Fragmentation is %d",ef);
getch();
}

INPUT
Enter the total memory available (in Bytes) -- 1000
Enter the block size (in Bytes)-- 300
Enter the number of processes – 5
Enter memory required for process 1 (in Bytes) -- 275
Enter memory required for process 2 (in Bytes) -- 400
Enter memory required for process 3 (in Bytes) -- 290
Enter memory required for process 4 (in Bytes) -- 293
Enter memory required for process 5 (in Bytes) -- 100
No. of Blocks available in memory -- 3
OUTPUT
PROCESS MEMORY-REQUIRED ALLOCATED INTERNAL-FRAGMENTATION
1 275 YES 25
2 400 NO -----
3 290 YES 10
4 293 YES 7
Memory is Full, Remaining Processes cannot be accommodated
Total Internal Fragmentation is 42
Total External Fragmentation is 100

--------------------------------------------------------------------------------------------
MVT MEMORY MANAGEMENT TECHNIQUE
#include<stdio.h>
#include<conio.h>
main()
{
int ms,mp[10],i, temp,n=0;
char ch = 'y';
clrscr();
printf("\nEnter the total memory available (in Bytes)-- ");
scanf("%d",&ms);
temp=ms;
for(i=0;ch=='y';i++,n++)
{
printf("\nEnter memory required for process %d (in Bytes) -- ",i+1);
scanf("%d",&mp[i]);
if(mp[i]<=temp)
{
printf("\nMemory is allocated for Process %d ",i+1);
temp = temp - mp[i];
}
else
{
printf("\nMemory is Full");
break;
}
printf("\nDo you want to continue(y/n) -- ");
scanf(" %c", &ch);
}
printf("\n\nTotal Memory Available -- %d", ms);
printf("\n\n\tPROCESS\t\t MEMORY ALLOCATED ");
for(i=0;i<n;i++)
printf("\n \t%d\t\t%d",i+1,mp[i]);
printf("\n\nTotal Memory Allocated is %d",ms-temp);
printf("\nTotal External Fragmentation is %d",temp);
getch();
}
INPUT
Enter the total memory available (in Bytes) -- 1000
Enter memory required for process 1 (in Bytes) -- 400
Memory is allocated for Process 1
Do you want to continue(y/n) -- y
Enter memory required for process 2 (in Bytes) -- 275
Memory is allocated for Process 2
Do you want to continue(y/n) -- y
Enter memory required for process 3 (in Bytes) -- 550
OUTPUT
Memory is Full
Total Memory Available -- 1000
PROCESS MEMORY-ALLOCATED
1 400
2 275
Total Memory Allocated is 675
Total External Fragmentation is 325

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy