修改Nachos,完成对应的进程(线程)调度算法。
具体算法有:先来先服务(FCFS)、静态优先级调度(PS)、实时调度(SJF)等。
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1020 2002-12-16 18:57 NachOS-4.1COPYRIGHT
文件 2337 2011-05-14 09:03 NachOS-4.1.project
文件 11355 2011-05-14 09:03 NachOS-4.1.cproject
文件 853 2002-12-16 18:57 NachOS-4.1coff2noff
off.h
文件 2314 2002-12-16 18:57 NachOS-4.1coff2noffcoff.h
文件 9608 2003-10-07 22:57 NachOS-4.1coff2noffcoff2noff.c
文件 1229 2002-12-16 18:57 NachOS-4.1coff2noffcopyright.h
文件 1187 2003-10-08 00:15 NachOS-4.1coff2noffMakefile.in
文件 476 2003-10-08 00:16 NachOS-4.1coff2noffconfigure.ac
文件 528 2003-10-07 23:07 NachOS-4.1coff2noffconfig.h.in
文件 95105 2003-10-07 23:07 NachOS-4.1coff2noffconfigure
文件 6888 2011-04-29 13:59 NachOS-4.1coff2noffconfig.log
文件 12088 2011-04-28 19:17 NachOS-4.1coff2noffcoff2noff.o
文件 18584 2011-04-29 13:59 NachOS-4.1coff2noffconfig.status
文件 5992 2011-04-28 19:17 NachOS-4.1coff2noffcoff2noff
文件 1192 2011-04-29 13:59 NachOS-4.1coff2noffMakefile
文件 602 2011-04-28 19:17 NachOS-4.1coff2noffconfig.h
文件 2023 2003-10-08 00:23 NachOS-4.1codeREADME
文件 2486 2011-05-14 09:16 NachOS-4.1code.project
文件 19135 2011-05-14 09:16 NachOS-4.1code.cproject
文件 682 2003-10-07 17:36 NachOS-4.1codeshellshell.c
文件 7016 2003-10-11 00:06 NachOS-4.1codeshell
achos_syscall.c
文件 293 2003-10-09 21:53 NachOS-4.1codeshellMakefile.in
文件 1837 2003-10-07 21:58 NachOS-4.1codeshellconfig.h.in
文件 767 2003-10-07 21:59 NachOS-4.1codeshellconfigure.ac
文件 108874 2003-10-08 03:24 NachOS-4.1codeshellconfigure
文件 4760 2003-10-09 21:51 NachOS-4.1codeshell
achos_syscall.h
文件 10743 2002-12-16 18:57 NachOS-4.1codeuserprogaddrspace.cc
文件 1697 2002-12-16 18:57 NachOS-4.1codeuserprogaddrspace.h
文件 4341 2002-12-16 18:57 NachOS-4.1codeuserprogerrno.h
............此处省略180个文件信息
/* 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(
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1020 2002-12-16 18:57 NachOS-4.1COPYRIGHT
文件 2337 2011-05-14 09:03 NachOS-4.1.project
文件 11355 2011-05-14 09:03 NachOS-4.1.cproject
文件 853 2002-12-16 18:57 NachOS-4.1coff2noff
off.h
文件 2314 2002-12-16 18:57 NachOS-4.1coff2noffcoff.h
文件 9608 2003-10-07 22:57 NachOS-4.1coff2noffcoff2noff.c
文件 1229 2002-12-16 18:57 NachOS-4.1coff2noffcopyright.h
文件 1187 2003-10-08 00:15 NachOS-4.1coff2noffMakefile.in
文件 476 2003-10-08 00:16 NachOS-4.1coff2noffconfigure.ac
文件 528 2003-10-07 23:07 NachOS-4.1coff2noffconfig.h.in
文件 95105 2003-10-07 23:07 NachOS-4.1coff2noffconfigure
文件 6888 2011-04-29 13:59 NachOS-4.1coff2noffconfig.log
文件 12088 2011-04-28 19:17 NachOS-4.1coff2noffcoff2noff.o
文件 18584 2011-04-29 13:59 NachOS-4.1coff2noffconfig.status
文件 5992 2011-04-28 19:17 NachOS-4.1coff2noffcoff2noff
文件 1192 2011-04-29 13:59 NachOS-4.1coff2noffMakefile
文件 602 2011-04-28 19:17 NachOS-4.1coff2noffconfig.h
文件 2023 2003-10-08 00:23 NachOS-4.1codeREADME
文件 2486 2011-05-14 09:16 NachOS-4.1code.project
文件 19135 2011-05-14 09:16 NachOS-4.1code.cproject
文件 682 2003-10-07 17:36 NachOS-4.1codeshellshell.c
文件 7016 2003-10-11 00:06 NachOS-4.1codeshell
achos_syscall.c
文件 293 2003-10-09 21:53 NachOS-4.1codeshellMakefile.in
文件 1837 2003-10-07 21:58 NachOS-4.1codeshellconfig.h.in
文件 767 2003-10-07 21:59 NachOS-4.1codeshellconfigure.ac
文件 108874 2003-10-08 03:24 NachOS-4.1codeshellconfigure
文件 4760 2003-10-09 21:51 NachOS-4.1codeshell
achos_syscall.h
文件 10743 2002-12-16 18:57 NachOS-4.1codeuserprogaddrspace.cc
文件 1697 2002-12-16 18:57 NachOS-4.1codeuserprogaddrspace.h
文件 4341 2002-12-16 18:57 NachOS-4.1codeuserprogerrno.h
............此处省略180个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)