資源簡介
模擬操作系統進程管理,存儲管理和文件管理等功能,界面為dos選擇界面。

代碼片段和文件信息
#include“file_system.h“
#include“memory_management.h“
#include“process_dispatch.h“
void?File_menu();
void?Memory_menu();
void?Process_menu();
int?ff?=?0;//標記內存管理
//文件管理
void?File_menu()
{
char?command[100];
int?flag;
char?way[100];
char?cway[100];
while(1)
{
printf(“%s:>“path);
scanf(“%s“command);
if(strcmp(command“exit“)?==?0)
break;
if(strcmp(command“dir“)?!=?0?&&?strcmp(command“help“)?!=?0)
scanf(“%s“way);
if(strcmp(command“copy“)?==?0)
{
scanf(“%s“cway);
Is_copy?=?1;
}
else
Is_copy?=?0;
flag?=?order(command);
switch(flag)
{
case?1:
Make_Dir(way);
break;
case?2:
Delete_Dir(way);
break;
case?3:
Change_Dir(way);
break;
case?4:
Show_Dir();
break;
case?5:
Create_File(way);
break;
case?6:
Show_Content_File(way);
break;
case?7:
Change_Property_File(way);
break;
case?8:
Close_File(way);
break;
case?9:
Open_File(way);
break;
case?10:
Read_File(way);
break;
case?11:
Write_File(way);
break;
case?12:
Delete_File(way);
break;
case?13:
Copy_File(waycway);
break;
case?14:
Help();
break;
default:
printf(“命令錯誤!可輸入help獲取幫助\n“);
break;
}
}
}
//內存管理
void?Memory_menu()
{
int?flag?=?1;
int?slect;
if(ff?==?0)
{
CreateMemory();
InitProcess(&process);
CreateProcess();
ApplyMemory();
system(“cls“);
}
while(flag)
{
printf(“\t\t\t?1.申請內存\n“);
printf(“\t\t\t?2.回收內存\n“);
printf(“\t\t\t?3.顯示內存信息\n“);
printf(“\t\t\t?4.顯示進程頁表信息\n“);
printf(“\t\t\t?5.地址轉換\n“);
printf(“\t\t\t?6.退出\n“);
printf(“請選擇:“);
scanf(“%d“&slect);
switch(slect)
{
case?1:
system(“cls“);
Apply();
break;
case?2:
system(“cls“);
Recycle();
break;
case?3:
system(“cls“);
PrintMemory();
break;
case?4:
system(“cls“);
PrintProcessSegment();
break;
case?5:
system(“cls“);
AddressExchange();
break;
case?6:
flag?=?0;
break;
default:
printf(“輸入錯誤請重新選擇!\n“);
break;
}
}
}
//進程調度
void?Process_menu()
{
int?i?=?0;
PCB?*r;
r?=?process->next;
printf(“請選擇調度方法:\n1:FCFS?2:?PRIORITY\n“);
scanf(“%d“&i);
if(!r)
{
free(process);
switch(i)
{
case?1:
flag?=?1;
CreateList(pcb_ready);
Show_State(pcb_readypcb_runningpcb_finished);
printf(“\n開始調度:\n“);
Dispatch_FCFS(pcb_readypcb_runningpcb_finished);
Show_State(pcb_readypcb_runningpcb_finished);
break;
case?2:
flag?=?2;
CreateList(pcb_ready);
Show_State(pcb_readypcb_runningpcb_finished);
printf(“\n開始調度:\n“);
Dispatch_PRI(pcb_readypcb_runningpcb_finished);
Show_State(pcb_readypcb_runningpcb_finished);
break;
default:
break;
}
free(pcb_running);
????free(pcb_ready);
???? free(pcb_finished);
???? ff?=?0;
}
else
{
switch(i)
{
case?1:
flag?=?1;
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-04-07?20:07??OS_TEST4\
?????目錄???????????0??2014-04-07?20:07??OS_TEST4\Debug\
?????文件??????237677??2014-03-08?09:44??OS_TEST4\Debug\OS_TEST4.exe
?????文件??????298332??2014-03-08?09:44??OS_TEST4\Debug\OS_TEST4.ilk
?????文件?????3666992??2014-03-08?09:44??OS_TEST4\Debug\OS_TEST4.pch
?????文件??????607232??2014-03-08?09:44??OS_TEST4\Debug\OS_TEST4.pdb
?????文件??????111319??2014-03-08?09:44??OS_TEST4\Debug\main.obj
?????文件??????148480??2014-03-08?09:44??OS_TEST4\Debug\vc60.idb
?????文件???????77824??2014-03-08?09:44??OS_TEST4\Debug\vc60.pdb
?????文件????????4507??2013-06-29?10:47??OS_TEST4\OS_TEST4.dsp
?????文件?????????541??2013-06-29?10:08??OS_TEST4\OS_TEST4.dsw
?????文件???????91136??2014-03-08?09:44??OS_TEST4\OS_TEST4.ncb
?????文件???????54784??2014-03-08?09:44??OS_TEST4\OS_TEST4.opt
?????文件?????????891??2014-03-08?09:44??OS_TEST4\OS_TEST4.plg
?????文件???????23591??2013-06-29?11:19??OS_TEST4\file_system.h
?????文件????????4509??2014-03-08?09:44??OS_TEST4\main.cpp
?????文件???????24312??2013-07-17?16:53??OS_TEST4\memory_management.h
?????文件???????10636??2013-07-04?18:44??OS_TEST4\process_dispatch.h
- 上一篇:OpenGL soil庫與布置方法,位置
- 下一篇:安卓無線點餐源代碼
評論
共有 條評論