NachOS线程调度_基于优先级和Round Robin算法
NachOS线程调度_基于优先级和Round Robin算法
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 605 2009-05-05 11:30 读我.txt
文件 34419 2009-05-05 04:10 test2.log
文件 143872 2009-05-05 11:25 NachOS线程调度技术报告.doc
文件 190668 2009-05-05 11:23 NachOS线程调度技术报告.pdf
文件 63072 2009-05-05 04:15 codeuild.linuxaddrspace.o
文件 62132 2009-05-05 04:15 codeuild.linuxalarm.o
文件 47184 2009-04-09 15:06 codeuild.linuxitmap.o
文件 64844 2009-05-05 04:15 codeuild.linuxconsole.o
文件 39564 2009-04-09 15:06 codeuild.linuxdebug.o
文件 49936 2009-04-09 15:06 codeuild.linuxdirectory.o
文件 67240 2009-05-05 04:15 codeuild.linuxdisk.o
文件 131076 2009-04-03 10:20 codeuild.linuxDISK_0
文件 53616 2009-05-05 04:15 codeuild.linuxexception.o
文件 55944 2009-05-05 04:15 codeuild.linuxfilehdr.o
文件 860 2009-04-09 15:06 codeuild.linuxfilesys.o
文件 83784 2009-05-05 04:15 codeuild.linuxinterrupt.o
文件 83920 2009-05-05 04:15 codeuild.linuxkernel.o
文件 104832 2009-04-09 15:06 codeuild.linuxlibtest.o
文件 59504 2009-05-05 04:15 codeuild.linuxmachine.o
文件 225152 2009-05-05 04:15 codeuild.linuxmain.o
文件 11953 2009-04-03 10:12 codeuild.linuxMakefile
文件 215140 2009-04-04 02:11 codeuild.linuxMakefile.dep
文件 11972 2003-10-11 00:40 codeuild.linuxMakefile~
文件 68076 2009-05-05 04:15 codeuild.linuxmipssim.o
文件 977079 2009-05-05 04:15 codeuild.linux
achos
文件 66796 2009-05-05 04:15 codeuild.linux
etwork.o
文件 861 2009-04-09 15:06 codeuild.linuxopenfile.o
文件 45796 2009-04-09 15:06 codeuild.linuxpbitmap.o
文件 92800 2009-05-05 04:15 codeuild.linuxpost.o
文件 76612 2009-05-05 04:15 codeuild.linuxscheduler.o
............此处省略106个文件信息
/* 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 “
“ 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(
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 605 2009-05-05 11:30 读我.txt
文件 34419 2009-05-05 04:10 test2.log
文件 143872 2009-05-05 11:25 NachOS线程调度技术报告.doc
文件 190668 2009-05-05 11:23 NachOS线程调度技术报告.pdf
文件 63072 2009-05-05 04:15 codeuild.linuxaddrspace.o
文件 62132 2009-05-05 04:15 codeuild.linuxalarm.o
文件 47184 2009-04-09 15:06 codeuild.linuxitmap.o
文件 64844 2009-05-05 04:15 codeuild.linuxconsole.o
文件 39564 2009-04-09 15:06 codeuild.linuxdebug.o
文件 49936 2009-04-09 15:06 codeuild.linuxdirectory.o
文件 67240 2009-05-05 04:15 codeuild.linuxdisk.o
文件 131076 2009-04-03 10:20 codeuild.linuxDISK_0
文件 53616 2009-05-05 04:15 codeuild.linuxexception.o
文件 55944 2009-05-05 04:15 codeuild.linuxfilehdr.o
文件 860 2009-04-09 15:06 codeuild.linuxfilesys.o
文件 83784 2009-05-05 04:15 codeuild.linuxinterrupt.o
文件 83920 2009-05-05 04:15 codeuild.linuxkernel.o
文件 104832 2009-04-09 15:06 codeuild.linuxlibtest.o
文件 59504 2009-05-05 04:15 codeuild.linuxmachine.o
文件 225152 2009-05-05 04:15 codeuild.linuxmain.o
文件 11953 2009-04-03 10:12 codeuild.linuxMakefile
文件 215140 2009-04-04 02:11 codeuild.linuxMakefile.dep
文件 11972 2003-10-11 00:40 codeuild.linuxMakefile~
文件 68076 2009-05-05 04:15 codeuild.linuxmipssim.o
文件 977079 2009-05-05 04:15 codeuild.linux
achos
文件 66796 2009-05-05 04:15 codeuild.linux
etwork.o
文件 861 2009-04-09 15:06 codeuild.linuxopenfile.o
文件 45796 2009-04-09 15:06 codeuild.linuxpbitmap.o
文件 92800 2009-05-05 04:15 codeuild.linuxpost.o
文件 76612 2009-05-05 04:15 codeuild.linuxscheduler.o
............此处省略106个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)