操作系统安全课程设计报告-0906130204-廖浩伟
(3)结束进程模块
结束进程 判断显示队列中是否选定了进程? 否 是 提示选定进程 判断该进程是否有子进程? 结束子进程 是 否 结束该进程 结束进程完成 - 4 -
操作系统安全课程设计报告-0906130204-廖浩伟
2.3进程模块实现原理
数据来源:打开系统盘下windows目录下的system32目录,启动系统自带的集成工具wmic,输入process命令即可取出数据。
代码操作:通过System.getnev()函数,按照一定语法输入指令,之后得到输出流,将数据存入实现创建完成的动态数组中,展示时将数据从数组中取出来放到容器中即可。
2.4服务模块实现原理
数据来源:同进程模块类似,打开系统盘下windows目录下的system32目录,启动系统自带的集成工具wmic,输入service命令即可取出数据。
代码操作:通过System.getnev()函数,按照一定语法输入指令,之后得到输出流,将数据存入实现创建完成的动态数组中,展示时将数据从数组中取出来放到容器中即可。
2.5 CPU、内存等系统性能模块原理
数据来源:java本身的API即可取得数据
代码操作:通过System.getProperty();函数即可得到系统的名字以及版本信息,通过ManagementFactory.getOperatingSystemMXBean()函数得到管理工具,再通过getTotalPtysicalMemorySize()等函数即可得到系统内存等信息。
三、详细设计
3.1进程单元数据结构设计
package 进程管理与监控;
public class ProcessStruct { private String caption; private String csname; private String priority; private String processId; private String threadCount;
ProcessStruct(String caption, String csname, String priority, String processId, String threadCount) { this.caption = caption; this.csname = csname;
this.priority = priority; this.processId = processId;
this.threadCount = threadCount;
- 5 -
操作系统安全课程设计报告-0906130204-廖浩伟
}
}
public String getCaption() { return this.caption; }
public String getCSName() { return this.csname; }
public String getPriority() { return this.priority; }
public String getProcessId() { return this.processId; }
public String getThreadCount() { return this.threadCount; }
3.2服务单元数据结构设计
package 进程管理与监控;
public class ServiceStruct { private String name;
private String processid; private String displayname; private String state;
private String startname;
ServiceStruct(String name, String processid, String displayname,
String state, String startname) { this.name = name;
this.processid = processid;
this.displayname = displayname; this.state = state;
this.startname = startname;
- 6 -
操作系统安全课程设计报告-0906130204-廖浩伟
}
}
public String getName() { return this.name; }
public String getProcessId() { return this.processid; }
public String getDisplayName() { return this.displayname; }
public String getState() { return this.state; }
public String getStartName() { return this.startname; }
3.3系统属性数据结构
package 进程管理与监控;
public class MonitorInfoBean {
// 操作系统
private String osName;
// 总的物理内存
private long totalMemorySize;
// 剩余的物理内存
private long freePhysicalMemorySize;
// 已使用的物理内存
private long usedMemory;
- 7 -
操作系统安全课程设计报告-0906130204-廖浩伟
public long getFreePhysicalMemorySize() { return freePhysicalMemorySize; }
public void setFreePhysicalMemorySize(long freePhysicalMemorySize) {
this.freePhysicalMemorySize = freePhysicalMemorySize; }
public String getOsName() { return osName; }
public void setOsName(String osName) { this.osName = osName; }
public long getTotalMemorySize() { return totalMemorySize; }
public void setTotalMemorySize(long totalMemorySize) { this.totalMemorySize = totalMemorySize; }
public long getUsedMemory() { return usedMemory; }
public void setUsedMemory(long usedMemory) { this.usedMemory = usedMemory; } }
3.4获得并存储信息的模块
package 进程管理与监控;
import java.io.InputStreamReader;
- 8 -