Add README and supporting materials

This commit is contained in:
AndrewTrieu
2023-02-05 16:53:31 +02:00
committed by Andrew Trieu
parent 6f5c7f67b4
commit 673ce20f3a
161 changed files with 960 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
<!doctype html>
<html>
<head>
<title>Description Submission of exercise solutions, THU 8-10 Zoom group</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p dir="ltr">Participants of the Thursday Zoom group may use this tool to submit their solutions, so it's easier for the assistants to check them.</p><p dir="ltr">NOTE! You have to participate in the group and ask an assistant to check your solutions in order to get points! (Just submitting a PDF is not enough.)</p><p dir="ltr">The Zoom link of the exercise group will be posted here below:</p><p dir="ltr"><br></p><p dir="ltr"></p><p><a href="https://lut.zoom.us/j/67068742188?pwd=Tkk4NUhHV0hSRUtuQnlpYnh3MjdmQT09">https://lut.zoom.us/j/67068742188?pwd=Tkk4NUhHV0hSRUtuQnlpYnh3MjdmQT09</a></p><p>Meeting ID: 670 6874 2188</p><p>
Passcode: 960727 </p><br><p></p><br><p></p>
</body>
</html>

View File

@@ -0,0 +1,14 @@
<!doctype html>
<html>
<head>
<title>Description Submission of exercise solutions, WED 8-10 Zoom group</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;">Participants of the Wednesday Zoom group may use this tool to submit their solutions, so it's easier for the assistants to check them.</p><p dir="ltr" style="text-align: left;">NOTE! You have to participate in the group and ask an assistant to check your solutions in order to get points! (Just submitting a PDF is not enough.)</p><p dir="ltr" style="text-align: left;">The Zoom link of the exercise group will be posted here below:</p><p dir="ltr" style="text-align: left;"><br></p><p dir="ltr" style="text-align: left;"><a href="https://lut.zoom.us/j/61197470396?pwd=TXNHaG5UTUl4Y0JaQVpyRFM5Ynd3UT09" style="background-color: rgb(255, 255, 255);"></a></p><p><a href="https://lut.zoom.us/j/61197470396?pwd=TXNHaG5UTUl4Y0JaQVpyRFM5Ynd3UT09">https://lut.zoom.us/j/61197470396?pwd=TXNHaG5UTUl4Y0JaQVpyRFM5Ynd3UT09</a>
</p>
<p>Meeting ID: 611 9747 0396&nbsp;</p><p>Passcode: 427819 </p><p> </p><br><p></p>
</body>
</html>

View File

@@ -0,0 +1,15 @@
<!doctype html>
<html>
<head>
<title>Description Submission of exercise solutions, Thursday 8-10 Zoom group</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p dir="ltr">Participants of the Thursday Zoom group may use this tool to submit their solutions, so it's easier for the assistants to check them.</p><p dir="ltr">NOTE! You have to participate in the group and ask an assistant to check your solutions in order to get points! (Just submitting a PDF is not enough.)</p><p dir="ltr">Deadline for submission of corrected versions in case something was wrong is 26.1 @ 23.59. The submission box allows 2 PDF files.</p><p dir="ltr">The Zoom link of the exercise group will be posted here below:</p><br><p><span lang="EN-US">Join Zoom Meeting <br>
</span><a href="https://lut.zoom.us/j/63860075285?pwd=aVp6TnoxeGp0N2MrRm5HcTQ0TnRkUT09"><span lang="EN-US">https://lut.zoom.us/j/63860075285?pwd=aVp6TnoxeGp0N2MrRm5HcTQ0TnRkUT09</span></a> <span lang="EN-US"></span></p>
<p>Meeting ID: 638 6007 5285 <br>
Passcode: 830574 </p><br><br><p></p>
</body>
</html>

View File

@@ -0,0 +1,15 @@
<!doctype html>
<html>
<head>
<title>Description Submission of exercise solutions, Wednesday 8-10 Zoom group</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p dir="ltr">Participants of the Wednesday Zoom group may use this tool to submit their solutions, so it's easier for the assistants to check them.</p><p dir="ltr">NOTE! You have to participate in the group and ask an assistant to check your solutions in order to get points! (Just submitting a PDF is not enough.)</p><p dir="ltr">Deadline for submission of corrected versions in case something was wrong is 25.1 @ 23.59. The submission box allows 2 PDF files.</p><p dir="ltr">The Zoom link of the exercise group will be posted here below:</p><p dir="ltr"><br></p><p><span lang="EN-US">Join Zoom Meeting <br>
</span><a href="https://lut.zoom.us/j/68948816292?pwd=NDh6VGNDQ1hMU0RiQ1VrMURwcGdPUT09"><span lang="EN-US">https://lut.zoom.us/j/68948816292?pwd=NDh6VGNDQ1hMU0RiQ1VrMURwcGdPUT09</span></a> <span lang="EN-US"></span></p>
<p><span lang="EN-US">Meeting ID: 689 4881 6292 <br>
Passcode: 849722 </span></p><br><p></p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Submission of exercise solutions, Thursday 8-10 Zoom group</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p dir="ltr">Participants of the Thursday Zoom group may use this tool to submit their solutions, so it's easier for the assistants to check them.</p><p dir="ltr"><strong>NOTE! You have to participate in the group and ask an assistant to check your solutions in order to get points! (Just submitting a PDF is not enough.)</strong></p><p dir="ltr">Deadline for submission of corrected versions in case something was wrong is 2.2 @ 23.59. The submission box allows 2 PDF files.</p><p dir="ltr">The Zoom link of the exercise group will be posted here below:</p><p dir="ltr"><br></p><p><span lang="EN-US">Join Zoom Meeting<br></span><a href="https://lut.zoom.us/j/68948816292?pwd=NDh6VGNDQ1hMU0RiQ1VrMURwcGdPUT09"><span lang="EN-US">https://lut.zoom.us/j/61015207711?pwd=MTZETWNSUkhLSGpocTllekwrL0FSQT09</span></a><span lang="EN-US"></span></p><p><span lang="EN-US">Meeting ID:&nbsp;610 1520 7711<br>Passcode:&nbsp;125562</span></p><br><p></p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Submission of exercise solutions, Wednesday 8-10 Zoom group</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p dir="ltr">Participants of the Wednesday Zoom group may use this tool to submit their solutions, so it's easier for the assistants to check them.</p><p dir="ltr"><strong>NOTE! You have to participate in the group and ask an assistant to check your solutions in order to get points! (Just submitting a PDF is not enough.)</strong></p><p dir="ltr">Deadline for submission of corrected versions in case something was wrong is 1.2 @ 23.59. The submission box allows 2 PDF files.</p><p dir="ltr">The Zoom link of the exercise group will be posted here below:</p><p dir="ltr"><br></p><p><span lang="EN-US">Join Zoom Meeting<br></span><a href="https://lut.zoom.us/j/68948816292?pwd=NDh6VGNDQ1hMU0RiQ1VrMURwcGdPUT09"><span lang="EN-US">https://lut.zoom.us/j/66739389609?pwd=VndOSDFqSGJyZy95alNraWFDVUYwQT09</span></a><span lang="EN-US"></span></p><p><span lang="EN-US">Meeting ID: 667 3938 9609<br>Passcode: 777546</span></p><p></p><p></p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Submission of exercise solutions, Thursday 8-10 group</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p dir="ltr">Participants of the Thursday Zoom group may use this tool to submit their solutions, so it's easier for the assistants to check them.</p><p dir="ltr"><strong>NOTE! You have to participate in the group and ask an assistant to check your solutions in order to get points! (Just submitting a PDF is not enough.)</strong></p><p dir="ltr">Deadline for submission of corrected versions in case something was wrong is 9.2 @ 23.59. The submission box allows 2 PDF files.</p><p dir="ltr">The Zoom link of the exercise group will be posted here below:</p><p dir="ltr"><br></p><p dir="ltr"></p><p><span lang="EN-US">Join Zoom Meeting<br></span><a href="https://lut.zoom.us/j/68948816292?pwd=NDh6VGNDQ1hMU0RiQ1VrMURwcGdPUT09"><span lang="EN-US">https://lut.zoom.us/j/66633342293?pwd=eDQxZUFvT1BVV2xacmVYSU0yZGVSQT09</span></a><span lang="EN-US"></span></p><p><span lang="EN-US">Meeting ID: 666 3334 2293<br>Passcode: 642220</span></p><br><p></p><br><p></p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Submission of exercise solutions, Wednesday 8-10 group</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p dir="ltr">Participants of the Wednesday Zoom group may use this tool to submit their solutions, so it's easier for the assistants to check them.</p><p dir="ltr"><strong>NOTE! You have to participate in the group and ask an assistant to check your solutions in order to get points! (Just submitting a PDF is not enough.)</strong></p><p dir="ltr">Deadline for submission of corrected versions in case something was wrong is 8.2 @ 23.59. The submission box allows 2 PDF files.</p><p dir="ltr">The Zoom link of the exercise group will be posted here below:</p><p dir="ltr"><br></p><p></p><p><span lang="EN-US">Join Zoom Meeting<br></span><a href="https://lut.zoom.us/j/68948816292?pwd=NDh6VGNDQ1hMU0RiQ1VrMURwcGdPUT09"><span lang="EN-US">https://lut.zoom.us/j/64007247967?pwd=MkR1Z1RTb0lmSHNUdUIrM3NuTEpOZz09</span></a><span lang="EN-US"></span></p><p><span lang="EN-US">Meeting ID: 640 0724 7967<br>Passcode: 363324</span></p><p></p><p></p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Submission of exercise solutions, Thursday 8-10 group</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p dir="ltr">Participants of the Thursday Zoom group may use this tool to submit their solutions, so it's easier for the assistants to check them.</p><p dir="ltr"><strong>NOTE! You have to participate in the group and ask an assistant to check your solutions in order to get points! (Just submitting a PDF is not enough.)</strong></p><p dir="ltr">Deadline for submission of corrected versions in case something was wrong is 16.2 @ 23.59. The submission box allows 2 PDF files.</p><p dir="ltr">The Zoom link of the exercise group will be posted here below:</p><br><p><span lang="EN-US">Join Zoom Meeting<br></span><a href="https://lut.zoom.us/j/68948816292?pwd=NDh6VGNDQ1hMU0RiQ1VrMURwcGdPUT09"><span lang="EN-US">https://lut.zoom.us/j/64223366875?pwd=QXgwR08xcGZ3NUgyUktoUG5sQnk1Zz09</span></a><span lang="EN-US"></span></p><p><span lang="EN-US">Meeting ID: 642 2336 6875<br>Passcode: 774776</span></p><br><p></p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Submission of exercise solutions, Wednesday 8-10 group</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p dir="ltr">Participants of the Wednesday Zoom group may use this tool to submit their solutions, so it's easier for the assistants to check them.</p><p dir="ltr"><strong>NOTE! You have to participate in the group and ask an assistant to check your solutions in order to get points! (Just submitting a PDF is not enough.)</strong></p><p dir="ltr">Deadline for submission of corrected versions in case something was wrong is 15.2 @ 23.59. The submission box allows 2 PDF files.</p><p dir="ltr">The Zoom link of the exercise group will be posted here below:</p><p dir="ltr"><br></p><p dir="ltr"></p><p><span lang="EN-US">Join Zoom Meeting<br></span><a href="https://lut.zoom.us/j/68948816292?pwd=NDh6VGNDQ1hMU0RiQ1VrMURwcGdPUT09"><span lang="EN-US">https://lut.zoom.us/j/63825753242?pwd=dEZHblkxRG02cDdBak93bFVzSThkZz09</span></a><span lang="EN-US"></span></p><p><span lang="EN-US">Meeting ID: 638 2575 3242<br>Passcode: 243681</span></p><br><p></p><br><p></p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Submission of exercise solutions, Thursday 8-10 group</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p dir="ltr">Participants of the Thursday Zoom group may use this tool to submit their solutions, so it's easier for the assistants to check them.</p><p dir="ltr"><strong>NOTE! You have to participate in the group and ask an assistant to check your solutions in order to get points! (Just submitting a PDF is not enough.)</strong></p><p dir="ltr">Deadline for submission of corrected versions in case something was wrong is 23.2 @ 23.59. The submission box allows 2 PDF files.</p><p dir="ltr">The Zoom link of the exercise group will be posted here below:</p><br><p><span lang="EN-US">Join Zoom Meeting<br></span><a href="https://lut.zoom.us/j/68948816292?pwd=NDh6VGNDQ1hMU0RiQ1VrMURwcGdPUT09"><span lang="EN-US">https://lut.zoom.us/j/61801407773?pwd=OTlEZ0ZDQ2hudE5qRERQRjFXOVNtUT09</span></a><span lang="EN-US"></span></p><p><span lang="EN-US">Meeting ID: 618 0140 7773<br>Passcode: 772917</span></p><br><p></p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Submission of exercise solutions, Wednesday 8-10 group</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p dir="ltr">Participants of the Wednesday Zoom group may use this tool to submit their solutions, so it's easier for the assistants to check them.</p><p dir="ltr"><strong>NOTE! You have to participate in the group and ask an assistant to check your solutions in order to get points! (Just submitting a PDF is not enough.)</strong></p><p dir="ltr">Deadline for submission of corrected versions in case something was wrong is 22.2 @ 23.59. The submission box allows 2 PDF files.</p><p dir="ltr">The Zoom link of the exercise group will be posted here below:</p><br><p><span lang="EN-US">Join Zoom Meeting<br></span><a href="https://lut.zoom.us/j/68948816292?pwd=NDh6VGNDQ1hMU0RiQ1VrMURwcGdPUT09"><span lang="EN-US">https://lut.zoom.us/j/62138314064?pwd=SlVnT2QrdE9QaGJTdHJkcWVaTC83QT09</span></a><span lang="EN-US"></span></p><p><span lang="EN-US">Meeting ID: 621 3831 4064<br>Passcode: 986770</span></p><br><p></p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Submission of exercise solutions, Thursday 8-10 group</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p dir="ltr">Participants of the Thursday Zoom group may use this tool to submit their solutions, so it's easier for the assistants to check them.</p><p dir="ltr"><strong>NOTE! You have to participate in the group and ask an assistant to check your solutions in order to get points! (Just submitting a PDF is not enough.)</strong></p><p dir="ltr">Deadline for submission of corrected versions in case something was wrong is 2.3 @ 23.59. The submission box allows 2 PDF files.</p><p dir="ltr">The Zoom link of the exercise group will be posted here below:</p><p dir="ltr"><br></p><p dir="ltr"></p><p><span lang="EN-US">Join Zoom Meeting<br></span><a href="https://lut.zoom.us/j/68948816292?pwd=NDh6VGNDQ1hMU0RiQ1VrMURwcGdPUT09"><span lang="EN-US">https://lut.zoom.us/j/69411653853?pwd=ZGFpUWtGQUdTS3JvRlZSVXk2Ymp1UT09</span></a><span lang="EN-US"></span></p><p><span lang="EN-US">Meeting ID:&nbsp;694 1165 3853<br>Passcode:&nbsp;341560</span></p><br><p></p><p></p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Submission of exercise solutions, Wednesday 8-10 group</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p dir="ltr">Participants of the Wednesday Zoom group may use this tool to submit their solutions, so it's easier for the assistants to check them.</p><p dir="ltr"><strong>NOTE! You have to participate in the group and ask an assistant to check your solutions in order to get points! (Just submitting a PDF is not enough.)</strong></p><p dir="ltr">Deadline for submission of corrected versions in case something was wrong is 1.3 @ 23.59. The submission box allows 2 PDF files.</p><p dir="ltr">The Zoom link of the exercise group will be posted here below:</p><p dir="ltr"><br></p><p dir="ltr"></p><p><span lang="EN-US">Join Zoom Meeting<br></span><a href="https://lut.zoom.us/j/68948816292?pwd=NDh6VGNDQ1hMU0RiQ1VrMURwcGdPUT09"><span lang="EN-US">https://lut.zoom.us/j/62853483420?pwd=YlR1ZUgyKzVISkpCcEZYdm5OeE9ndz09</span></a><span lang="EN-US"></span></p><p><span lang="EN-US">Meeting ID:&nbsp;628 5348 3420<br>Passcode:&nbsp;456121</span></p><br><p></p><p></p>
</body>
</html>

View File

@@ -0,0 +1,187 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
//const int MAXJOB=50; // maximum number of jobs
#define MAXJOB 50
//data structure of jobs
typedef struct node
{
int number; // job number
int reach_time;// arrival time
int need_time;// execution time
int privilege;// priority
float excellent;// response ratio
int start_time;// start time
int wait_time;// waiting time
int visited;// if the job is accessed
bool isreached;// if the job has arrived
} job;
job jobs[MAXJOB];//job sequence
int quantity;//number of jobs
//initialize job sequence
void initial_jobs()
{
int i;
for(i=0;i<MAXJOB;i++)
{
jobs[i].number=0;
jobs[i].reach_time=0;
jobs[i].privilege=0;
jobs[i].excellent=0;
jobs[i].start_time=0;
jobs[i].wait_time=0;
jobs[i].visited=0;
jobs[i].isreached=false;
}
quantity=0;
}
//reset all job information
void reset_jinfo()
{
int i;
for(i=0;i<MAXJOB;i++)
{
jobs[i].start_time=0;
jobs[i].wait_time=0;
jobs[i].visited=0;
}
}
// Find the shortest job that has reached but not yet been executed. If not return -1
int findminjob(job jobs[],int count)
{
int minjob=-1;//=jobs[0].need_time;
int minloc=-1;
for(int i=0;i<count;i++)
{
if(minloc==-1){
if( jobs[i].isreached==true && jobs[i].visited==0){
minjob=jobs[i].need_time;
minloc=i;
}
}
else if(minjob>jobs[i].need_time&&jobs[i].visited==0&&jobs[i].isreached==true)
{
minjob=jobs[i].need_time;
minloc=i;
}
}
return minloc;
}
//Find the job that arrived ealiest
int findrearlyjob(job jobs[],int count)
{
int rearlyloc=-1;
int rearlyjob=-1;
for(int i=0;i<count;i++)
{
if(rearlyloc==-1){
if(jobs[i].visited==0){
rearlyloc=i;
rearlyjob=jobs[i].reach_time;
}
}
else if(rearlyjob>jobs[i].reach_time&&jobs[i].visited==0)
{
rearlyjob=jobs[i].reach_time;
rearlyloc=i;
}
}
return rearlyloc;
}
//read all job data
void readJobdata()
{
FILE *fp;
char fname[20];
int i;
//input the name of test file
printf("please input job data file name\n");
scanf("%s",fname);
if((fp=fopen(fname,"r"))==NULL)
{
printf("error, open file failed, please check filename:\n");
}
else
{
//read job information sequentially
while(!feof(fp))
{
if(fscanf(fp,"%d %d %d %d",&jobs[quantity].number,&jobs[quantity].reach_time,&jobs[quantity].need_time,&jobs[quantity].privilege)==4)
quantity++;
}
//print job information
printf("output the origin job data\n");
printf("---------------------------------------------------------------------\n");
printf("\tjobID\treachtime\tneedtime\tprivilege\n");
for(i=0;i<quantity;i++)
{
printf("\t%-8d\t%-8d\t%-8d\t%-8d\n",jobs[i].number,jobs[i].reach_time,jobs[i].need_time,jobs[i].privilege);
}
}
}
//FCFS
void FCFS()
{
int i;
int current_time=0;
int loc;
int total_waitime=0;
int total_roundtime=0;
loc=findrearlyjob(jobs,quantity);
//print job stream
printf("\n\nFCFS job stream\n");
printf("------------------------------------------------------------------------\n");
printf("\tjobID\treachtime\tstarttime\twaittime\troundtime\n");
current_time=jobs[loc].reach_time;
// Each loop finds the first arriving job and prints information about it
for(i=0;i<quantity;i++)
{
if(jobs[loc].reach_time>current_time)
{
jobs[loc].start_time=jobs[loc].reach_time;
current_time=jobs[loc].reach_time;
}
else
{
jobs[loc].start_time=current_time;
}
jobs[loc].wait_time=current_time-jobs[loc].reach_time;
printf("\t%-8d\t%-8d\t%-8d\t%-8d\t%-8d\n",loc+1,jobs[loc].reach_time,jobs[loc].start_time,jobs[loc].wait_time,
jobs[loc].wait_time+jobs[loc].need_time);
jobs[loc].visited=1;
current_time+=jobs[loc].need_time;
total_waitime+=jobs[loc].wait_time;
total_roundtime=total_roundtime+jobs[loc].wait_time+jobs[loc].need_time;
// Get the first arriving job among the remaining jobs
loc=findrearlyjob(jobs,quantity);
}
printf("total waiting time:%-8d total turnaround time:%-8d\n", total_waitime, total_roundtime);
printf("average waiting time: %4.2f average turnaround time: %4.2f\n", (float)total_waitime/(quantity),(float)total_roundtime/(quantity));
}
// Shortest-Job-First Scheduling algorithm.
void SFJschdulejob(job jobs[],int count)
{
}
// Highest Response Ratio Next
//response ratio=turnaround time/execution time
void HRRFschdulejob()
{
}
// Priority scheduling algorithm
void HPF(job jobs[])
{
}
void main()
{
initial_jobs();
readJobdata();
FCFS();
reset_jinfo();
SFJschdulejob(jobs, quantity);
system("pause");
//return 0;
}

View File

@@ -0,0 +1,118 @@
//#include "stdafx.h"
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#define VM_PAGE 7 /*Number of virtual pages*/
#define PM_PAGE 4 /* Number of memory blocks allocated to the job */
#define TOTAL_INSERT 18 /*Number of virtual page replacements*/
typedef struct
{
int vmn;
int pmn;
int exist;
int time;
}vpage_item;
vpage_item page_table[VM_PAGE];
vpage_item* ppage_bitmap[PM_PAGE];
int vpage_arr[TOTAL_INSERT] = { 1,2,3,4,2,6,2,1,2,3,7,6,3,2,1,2,3,6 }; // The access order virtual pages
void init_data() //initialize data
{
for (int i = 0; i<VM_PAGE; i++)
{
page_table[i].vmn = i + 1;
page_table[i].pmn = -1;
page_table[i].exist = 0;
page_table[i].time = -1;
}
for (int i = 0; i<PM_PAGE; i++) /*initialize the physical page map*/
{
ppage_bitmap[i] = NULL;
}
}
void FIFO()/*FIFO page replacement algorithem*/
{
int k = 0;
int i;
int sum = 0;
int missing_page_count = 0;
int current_time = 0;
bool isleft = true; /* Whether there are remaining physical blocks */
while (sum < TOTAL_INSERT)
{
if (page_table[vpage_arr[sum] - 1].exist == 0)
{
missing_page_count++;
if (k < 4)
{
if (ppage_bitmap[k] == NULL) /*find a free block*/
{
ppage_bitmap[k] = &page_table[vpage_arr[sum] - 1];
ppage_bitmap[k]->exist = 1;
ppage_bitmap[k]->pmn = k;
ppage_bitmap[k]->time = current_time;
k++;
}
}
else
{
int temp = ppage_bitmap[0]->time;
int j = 0;
for (i = 0; i < PM_PAGE; i++)
{
if (ppage_bitmap[i]->time < temp)
{
temp = ppage_bitmap[i]->time;
j = i;
}
}
ppage_bitmap[j]->exist = 0;
ppage_bitmap[j] = &page_table[vpage_arr[sum] - 1]; /*update page table */
ppage_bitmap[j]->exist = 1;
ppage_bitmap[j]->pmn = j;
ppage_bitmap[j]->time = current_time;
}
}
current_time++;
sum++;
}
printf("The number of page faults of FIFO is:%d\t Page fault rate:%f\t The number of replacement:%d\tReplacement rate:%f\n", missing_page_count, missing_page_count / (float)TOTAL_INSERT, missing_page_count - 4, (missing_page_count - 4) / (float)TOTAL_INSERT);
}
void LRU()
{
}
void OPT()
{
}
int main()
{
int a;
do
{
printf("Please choose page replacement algorithm1.FIFO\t2.LRU\t3.OPT\t0. quit\n");
scanf_s("%d", &a);
switch (a)
{
case 1:
init_data();
FIFO();
break;
case 2:
init_data();
LRU();
break;
case 3:
init_data();
OPT();
break;
}
} while (a != 0);
return 0;
}

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Feedback comments</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;">It is better to give steps to solve the problems.<br></p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Assigment6</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;">Assignment6</p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Assignment 7</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;">Assignment 7<br></p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Feedback comments</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align:left;">Great!</p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Assignment 8</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p dir="ltr">Assignment 8<br></p><br><p></p>
</body>
</html>

View File

@@ -0,0 +1,16 @@
<!doctype html>
<html>
<head>
<title>Feedback comments</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;"></p><p>Please check the answers for Q4 &amp; Q5<br>4)The two categories of services and functions provided by an operating system are: User services and system services</p>
<p>User services provides functions that are helpful to users, including user interface, program execution, I/O operations, file system operations, communication, and error detection</p>
<p>System services are not meant to help users but to ensure that the system itself runs efficiently.&nbsp; Systems with multiple users can gain efficiency by sharing the computer resources among the users. System services include resource allocation, accounting, protection and security.<br><span style="font-family: Montserrat, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;"><br>5) Three general methods of passing parameters are</span></p>
<p>a. Pass parameters in registers</p>
<p>b. Registers pass starting addresses of blocks of parameters</p>
<p>c. Parameters can be placed, or pushed, onto the stack by the program, and popped off the stack by the operating system&nbsp;</p><br><p></p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Assignment1</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;">Assignment1</p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Assignment10</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;">Assignment10<br></p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Description Assignment11</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left;">The assignment about mass storage</p>
</body>
</html>

View File

@@ -0,0 +1,12 @@
<!doctype html>
<html>
<head>
<title>Feedback comments</title>
<meta charset="utf-8">
</head>
<body>
<p dir="ltr" style="text-align:left;"></p><p><span lang="en-us" xml:lang="en-us">For question 1, an important aspect is
missing. That is process synchronization. -0.1</span></p><br /><p></p>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More