EssayGhost Assignment代写,Essay代写,网课代修,Quiz代考

EssayGhost-Essay代写,作业代写,网课代修代上,cs代写代考

一站式网课代修,论文代写

高质量的Assignment代写、Paper代写、Report代写服务

EG1hao
网课代修代上,cs代写代考
C语言代写
您的位置: 主页 > 编程案例 > C语言代写 >
代写C语言:Principles of Operating Systems代写 COMP3230A Program Assignment - C语言代写
发布时间:2021-07-25 20:08:44浏览次数:
accept multiple commands (with arguments) that are interconnected by the special symbol“!”,which acts as the pipe operator, andprint out the termination status and running statistics of each terminated childSpecificationBasic features of the timekeeper programWhen invoking the timekeeper program without arguments, it will terminate successfully without any output.When invoking the timekeeper program with input arguments, it will interpret the input and start the corresponding program(s) with necessary arguments. The timekeeper program should be able to execute any normal program (i.e. programs that are in binary format) that can be foundunderabsolute path (starting with /) specified in the command line,g../timekeeper /home/tmchan/a.outrelative path (starting with .) specified in the command line,g../timekeeper ./a.out abc 1000directories listed in environment variable $PATH,g../timekeeper gedit readme.txtwhere gedit is in the directory /usr/bin, and timekeeper should locate the target program by searching through all paths listed in the PATH environment variable, e.g.,$PATH=/bin:/usr/bin:/usr/local/binAfter a new child process is created, timekeeper will print out a message that shows the child process id. For example:Process with id: 11463 created for the command: catIf the target program cannot be started/executed, timekeeper will print out a message to indicate the problem. For example:timekeeper experienced an error in starting the command: xxxxxxTo reduce the complexity of this project, other special characters (e.g. ‘, “, , , , , |) will not beappeared in the input arguments.When the invoked program terminated, timekeeper will print out the wall clock (real) time, user time, and system time used by that process as well as the number of context switches experienced by that process. Here are the definitions of thosetimings:Real time: the elapsed wall clock time (in seconds) between the start and end of the invoked program.User time: the total number of CPU-seconds that the process spent in userSystem time: the total number of CPU-seconds that the process spent in kernelAll timings are displayed in units of second and have the precision of 2 decimal places. For example,real: 37.21 s, user: 4.13 s, system: 0.44 s, context switch: 20292When the invoked program terminated successfully, timekeeper will print out thatprocess’stermination status in addition to the running statistics as defined in item 3. For example,The command firefox terminated with returned status code = 0 real: 37.21 s, user: 4.13 s, system: 0.44 s, context switch: 20292The timekeeper process and its child process(es) are required to respond to the SIGINT signal (generated by pressing Ctrl-c or by the kill system command) as according to the followingguideline:Upon receiving the SIGINT signal, the child process(es) will respond to the signal as according to the predefined behavior of the program in response to the SIGINT signal; while the timekeeper process should not be affected by SIGINT and continue until it detects that its child processes have terminated.Instead of printing out a process’s termination status, timekeeper will output a message to indicate that the corresponding process is terminated by the SIGINT signal. Forexample,The command add is interrupted by the signal number = 2 (SIGINT) real: 1.38 s, user: 1.26 s, system: 0.10s, context switch: 33Like item 5, when the invoked program terminated involuntarily because of receiving signal (e.g. SIGSEGV), timekeeper will output a message to indicate that the corresponding process is terminated by a specific signal. Forexample,The command segfault is interrupted by the signal number = 11 (SIGSEGV)real: 0.45 s, user: 0.29 s, system: 0.02s, context switch: 27The timekeeper program uses a special symbol “!” to act as the pipe Please note thatweare not using the tradition pipe symbol “|” as we don’t want the shell process to be confused if “|”is used in this assignment. When the timekeeper process detects that its input arguments contain the special symbol “!”, it will identify the sequence of commands and will start the corresponding programs with necessary arguments. In addition, these programs will be linked up as according to the logical pipe defined by the input arguments. For example,./timekeeper cat c3230a.txt ! grep kernel ! wc -wIn this example, the timekeeper program will create three child processes to execute the cat, grep, and wc programs. The standard output of the cat process is connected to the standard input of the grep process, and the standard output of the grep process is connected to the standard input of the wc process.When detecting a child process has terminated, timekeeper will print out the termination status (or signal information) and running statistics of that terminated child process. Upon detecting all child processes have terminated, timekeeper will terminate too.System CallsYou need the following system calls to build the timekeeper program.fork() – The fork function is the main primitive for creating a childexec family of functions – Use one of these functions to make a child process execute a new program.waitpid() and waitid() – Wait for a child process to terminate or stop, and determine itssignal() and sigaction() – Specify how a signal should be handled by thepipe() – This creates both the reading and writing ends of the pipe for interprocess communication. The returned reading and writing ends are represented as filedup2() – This duplicates an open file descriptor onto another file descriptor; in other words, it allocates another file descriptor that refers to the same open file as theNote: You are not allowed to use the system() or popen() functions to execute the target program.DocumentationAt the head of the submitted source code, state clearlytheFilenameStudent’snameStudent NumberDevelopmentplatformCompilation – describe how to compile your programRemark – describe how much you havecompleted

所有的编程代写范围:essayghost为美国、加拿大、英国、澳洲的留学生提供C语言代写、代写C语言、C语言代做、代做C语言、数据库代写、代写数据库、数据库代做、代做数据库、Web作业代写、代写Web作业、Web作业代做、代做Web作业、Java代写、代写Java、Java代做、代做Java、Python代写、代写Python、Python代做、代做Python、C/C++代写、代写C/C++、C/C++代做、代做C/C++、数据结构代写、代写数据结构、数据结构代做、代做数据结构等留学生编程作业代写服务。