Question
convert this code to java language /* OPERATING SYSTEMS LAB PROJECT * AKASH JAIN * 179303013 * DESIGNING A VIRTUAL MEMORY MANAGER */ #include #include
convert this code to java language
/* OPERATING SYSTEMS LAB PROJECT * AKASH JAIN * 179303013 * DESIGNING A VIRTUAL MEMORY MANAGER */
#include
const int VM_SIZE=256; const int PAGE_SIZE=256; const int TLB_SIZE=16; const int MM_SIZE=256;
int main(int argc, char* argv[]) { FILE *fd; if(argc<2) { printf("NOT ENOUGH AGRUMENTS EXITING "); return 0; } fd=fopen(argv[1],"r"); if(fd==NULL) { printf("ERROR OPENING FILE FILE FAILED TO OPEN "); return 0; } char *value=NULL; size_t len=0; ssize_t read; long long page_no,offset,page_table,totalhits=0,fault=0,pages=0; int qp=0; //to maintain the queue position int physicalad=0,frame,logicalad; int tlb[TLB_SIZE][2]; int pagetable[PAGE_SIZE];
memset(tlb,-1,TLB_SIZE*2*sizeof(tlb[0][0])); memset(pagetable,-1,sizeof(pagetable)); int mask=255,mask1=62580,i,hit; while((read=getline(&value,&len,fd))!=-1) { pages++; //get page number and offset from logical address page_no=atoi(value); page_no=page_no>>8; page_no=page_no & mask; offset=atoi(value); offset=offset & mask; logicalad=atoi(value); //printf("%lld %lld ",page_no,offset); frame=0,physicalad=0; hit=0; //1 if found in TLB //CHECK IN TLB for(i=0;i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started