资源简介
NachOS 4.1版本 进程调度算法进行了修改 修改为基于优先级的时间片轮转调度算法
代码片段和文件信息
/* syscalls.c
* Nachos system call interface. These are the enveloped Nachos kernel
* operations that can be invoked from user programs.
* Each NachOS system call is translated to an apropriate LIBC call.
* Hopefully this works on MacOS X *nix and Windows
*/
#include “nachos_syscall.h“
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#ifdef HAVE_CONFIG_H
#include “config.h“
#endif
#define SHELL “/bin/sh“
/*
* The system call interface. These are the operations the Nachos
* kernel needs to support to be able to run user programs.
*/
/* Stop Nachos and print out performance stats */
void Halt()
{
Exit(0);
}
/*
* Add the two operants and return the result
*/
int Add(int op1 int op2)
{
return op1 + op2;
}
/* This user program is done (status = 0 means exited normally). */
void Exit(int status)
{
exit(status);
}
/* Address space control operations: Exit Exec Execv and Join */
/* Run the specified executable with no args */
/* This can be implemented as a call to ExecV.
*/
SpaceId Exec(char* exec_name)
{
pid_t child;
child = vfork();
if(child == 0)
{
execl (SHELL SHELL “-c“ exec_name NULL);
_exit (EXIT_FAILURE);
}
else if(child < 0)
return EPERM;
return (SpaceId) child;
}
/*
* Run the executable stored in the Nachos file “argv[0]“ with
* parameters stored in argv[1..argc-1] and return the
* address space identifier
* For this the incoming string has to be seperated by replacing “ “
* with “\n“ and building the appropriate pointer structure argv.
*/
SpaceId ExecV(int argc char* argv[])
{
pid_t child;
child = vfork();
if(child == 0){
execl (SHELL SHELL “-c“ argv NULL);
_exit (EXIT_FAILURE);
}
else if(child < 0)
return EPERM;
return (SpaceId) child;
}
/* Only return once the user program “id“ has finished.
* Return the exit status.
*/
int Join(SpaceId id)
{
return waitpid((pid_t) id (int*) 0 0);
}
/* File system operations: Create Remove Open Read Write Close
* These functions are patterned after UNIX -- files represent
* both files *and* hardware I/O devices.
*
* Note that the Nachos file system has a stub implementation which
* can be used to support these system calls if the regular Nachos
* file system has not been implemented.
*/
/* when an address space starts up it has two open files representing
* keyboard input and display output (in UNIX terms stdin and stdout).
* Read and Write can be used directly on these without first opening
* the console device.
*/
/* Create a Nachos file with name “name“ */
/* Note: Create does not open the file. */
/* Return 1 on success negative error code on failure */
int Create(char *name)
{
int fd;
fd=open(
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1169856 2010-05-08 02:24 5070369042杜星_NachOS实验报告一.docx
文件 187752 2002-12-16 18:57 NachOS-4.1\c++example\c++.ps
文件 66890 2002-12-16 18:57 NachOS-4.1\c++example\c++.tex
文件 1224 2002-12-16 18:57 NachOS-4.1\c++example\copyright.h
文件 6276 2002-12-16 18:57 NachOS-4.1\c++example\inheritstack.cc
文件 3026 2002-12-16 18:57 NachOS-4.1\c++example\inheritstack.h
文件 3604 2002-12-16 18:57 NachOS-4.1\c++example\list.cc
文件 919 2002-12-16 18:57 NachOS-4.1\c++example\list.h
文件 706 2002-12-16 18:57 NachOS-4.1\c++example\Makefile
文件 3569 2002-12-16 18:57 NachOS-4.1\c++example\stack.cc
文件 1399 2002-12-16 18:57 NachOS-4.1\c++example\stack.h
文件 3921 2002-12-16 18:57 NachOS-4.1\c++example\templatestack.cc
文件 1252 2002-12-16 18:57 NachOS-4.1\c++example\templatestack.h
文件 12006 2003-10-11 00:40 NachOS-4.1\code\build.cygwin\Makefile
文件 31309 2002-12-16 18:57 NachOS-4.1\code\build.cygwin\Makefile.dep
文件 61128 2010-05-07 22:53 NachOS-4.1\code\build.linux\addrspace.o
文件 56480 2010-05-07 22:52 NachOS-4.1\code\build.linux\alarm.o
文件 45920 2010-05-07 22:52 NachOS-4.1\code\build.linux\bitmap.o
文件 62512 2010-05-07 22:52 NachOS-4.1\code\build.linux\console.o
文件 38552 2010-05-07 22:52 NachOS-4.1\code\build.linux\debug.o
文件 48516 2010-05-07 22:53 NachOS-4.1\code\build.linux\directory.o
文件 65512 2010-05-07 22:52 NachOS-4.1\code\build.linux\disk.o
文件 131076 2010-05-07 22:53 NachOS-4.1\code\build.linux\DISK_0
文件 51948 2010-05-07 22:53 NachOS-4.1\code\build.linux\exception.o
文件 54500 2010-05-07 22:53 NachOS-4.1\code\build.linux\filehdr.o
文件 848 2010-05-07 22:53 NachOS-4.1\code\build.linux\filesys.o
文件 81604 2010-05-07 22:52 NachOS-4.1\code\build.linux\interrupt.o
文件 62544 2010-05-07 22:52 NachOS-4.1\code\build.linux\kernel.o
文件 103016 2010-05-07 22:52 NachOS-4.1\code\build.linux\libtest.o
文件 57688 2010-05-07 22:52 NachOS-4.1\code\build.linux\machine.o
............此处省略166个文件信息
- 上一篇:Jli
nk驱动4.40版本 - 下一篇:80386及其编程.rar
相关资源
- NachOS线程调度_基于优先级和Round Rob
- 操作系统Nachos实验---4个全的。。
- nachos Lab4实习报告.pdf
- 采用时间片轮转算法的进程调度程序
- 综合使用作业调度和进程调度模拟作
- 操作系统,nachos实验报告,源码
- 操作系统 nachos实验四
- 操作系统实验 7种进程调度算法的实现
- 北大Nachos文件系统实习报告
- 操作系统进程调度算法实验报告
- Nachos实验代码
- 山东大学操作系统课程设计nachos
- 山东大学操作系统课设nachos实验报告
- 山东大学操作系统课程设计nachos实验
- nachos 3.4线程+文件系统+虚拟内存实习
- 大连理工大学操作系统上机进程调度
- 进程调度的设计与实现
- Nachos调度和虚存的实现文档
- 实现单处理机下的进程调度程序
- 时间片轮转调度算法
- 操作系统 进程调度时间片轮转银行家
- 动态优先数高者进程调度算法
- nachos第一次实验
- 北京化工大学操作系统上机源码八个
- 进程调度 优先权和轮转法
- 进程管理大作业源码电梯调度算法操
- Nachos虚存页面置换算法
- 操作系统实验-模拟进程调度
- 优先数调度算法实现处理器调度
- 时间片轮转算法的进程调度程序
评论
共有 条评论