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

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

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

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

EG1hao
网课代修代上,cs代写代考
C++代做
您的位置: 主页 > 编程案例 > C++代做 >
代做C++/C:c语言作业代写 CS270 - System Software Hw #4 - C++代做
发布时间:2021-07-25 22:55:32浏览次数:
Due on or before October 28 at 11:59:59 PMFor this assignment you are to build a Linux program that employs cooperating processes to accomplish specified tasks. We won’t be able to use pipes or sockets since we haven’t covered them yet, but it should be a fun assignment regardless. Your program must be written in Your program will be compiled and tested on cs-course36.cs.uidaho.edu, so you should at least test it there before you turn it in.c语言作业代写1 The Program The program that you are going to build is called ptor. A brief description of ptor follows:usage: ptorThe ptor program is used to perform tasks that are specified by the user. The tasks that can be performed are described in the section titled ”User Commands.”1.1 Program Options The ptor program does not take any command-line options.1.2 Program Mechanics The ptor program is composed of two processes that cooperate to accomplish tasks that are specified by the user. The two processes are referred to in this document as the parent and the child.The typical ptor user has no idea that two processes are used to accomplish the specified tasks. The interplay between the parent and child processes are of particular importance to you, however, since you will be building ptor rather than just using it. The parent and child processes communicate via Linux signals, and send and receive data from one another using text files. The ptor program creates two text files, one named ”ptor-parent-NN” where NN is replaced with the PID of the parent process, and another named ”ptor-child-NN” where NN is replaced with the PID of the child process. These two files are hereafter referred to as ptor-parent-file and ptor-child-file respectively.The following list specifies the mechanics of the interplay between the cooperating processes that are used to execute user commands. This interplay is very important. You should study this list carefully, and build your program so that it behaves as specified in this list.Userlaunches  ptor  on  the  shell  command-lineParentprocess  executes  system  call  to  create  child  processParentprocess  waits  to  receive  SIGUSR1  signal  from  child  processChildprocess,  when  ready,  sends  SIGUSR1  signal  to  parent  processParentprocess  emits  a  command  prompt  of  the  form   cmd:     and  waits  for  the user  to  enter  a  command.Userenters  command.Parentprocess  checks  command. If  command  is   exit ,  GOTO  Step  16  below.Parentprocess  writes  the  specified  command  to  ptor-parent-file.Parentsends  SIGUSR1  signal  to  child.Childprocess,  upon  receiving  the  SIGUSR1  signal,  opens  ptor-parent-file and processes the command containedChildprocess  interprets  and  executes  the  specified  command.Childprocess  writes  the  result  of  executing  the  specified  command  into ptor-child-file.Childprocess  sends  signal  SIGUSR2  to  parent  process.Parentprocess,  upon  receipt  of  the  SIGUSR2  signal,  opens  ptor-child-file, reads the result contained therein, and displays the result to theA  newline  character  is  appended  to  the  result  (if  necessary)  to  keep  things neat and tidy for the user.GOTOStep  5  above.Parentprocess  sends  SIGUSR2  signal  to  child  process  and  waits  for  child process  to  terminate.Childprocess,  upon  receipt  of  signal  SIGUSR2,  terminates  with  an  exit status  that  is  the  count  of  the  number  of  invalid  commands  that  the  user specified during the currentWhenchild  process  terminates,  parent  process  emits  message  of  the  form ptor:  terminating  with  status  NN   where  NN  is  replaced  with  the  exit status of the childParentprocess  exits  with  status  NN,  the  same  exit  status  as  the  child1.3 User Commands The following describes the tasks that ptor can be used to accomplish. If the user specifies any command other than those that are listed below, ptor will emit a message of the form ptor: Invalid command and continue processing commands.Hfname fname2 This command is used to specify that ptor should compute and display the  Hamming  distance  between  the  files  named  fname and  fname2.   The  files  named fname and fname2 must be the same siz If the file sizes differ, ptor will emit a message of the form  ptor:  H:  file  sizes  differ  to stdout.If the file sizes do not differ, ptor will compute the bitwise Hamming distance between fname and fname2 and print the result to stdout.  The result printed will be of the form ptor:  H:  Hamming  distance:  NN , where NN is the computed bitwise Hamming dis- tance.Ou This command is used to determine the next number that contains the same number of ‘1’ bits as u, where u is an unsigned integral number in decimal. The following is an example of this command in action:-bash-4.1$ ./ptor cmd:  O  4ptor:  O:  8cmd:  O  17ptor:  O:  18cmd:  O  10ptor:  O:  12 cmd:  exitptor:  terminating  with  status  0-bash-4.1$Rfname This command is used to specify that ptor should identify the longest run (as per Run-Length Encoding, or RLE) of bytes contained in fname. ptor prints the 0-based location of the byte that starts the run, the value of the byte contained within the run, and the 1-based length of the run to stdout. The location of the run and the length of the run are printed in base 10, while the value of the byte contained within the run is printed in baseThe following is an example of the output by this option when invoked on a file in which the longest run starts at 0-based byte 72. The run has a length of 113 bytes, and the value of the byte contained within the run is the space (32 or 0x20) character:ptor:  R:  72  0x20  113Xfname This command is used to specify that ptor should calculate and print the check- sum of the bytes in the file named fname.  The checksum calculated by ptor for this op- tion is a “modular summation”  This checksum is calculated by summing all the bytes in the file fname, ignoring any overflow, and then performing a two’s comple- ment of the sum to produce the final result. The result calculated by this option is printed to stdout and will be of the form:  ptor:  X:  0xXX  where XX (base 16) is the calculated checksum for the file fname.+ b1 b2 This command is used to specify that ptor should add the two binary num- bers b1 and b2 and print the result. The binary numbers b1 and b2 need not be the samelength.The ptor program places no upper bound on the maximum size of binary numbers that can be added. The result calculated by this command is printed to stdout and will be of the form:   ptor:  +:  bb  where bb (base 2) is the calculated sum.  The following is an example of this command in action:-bash-4.1$ ./ptor cmd:  +  11101  1ptor:  +:  11110cmd:  +  111111111111111111111111111111111111111111111111111111111111111111  1ptor:  +:  1000000000000000000000000000000000000000000000000000000000000000000cmd:  exitptor:  terminating  with  status  0-bash-4.1$!This command is used to specify that ptor should emit a message containing the count of valid and invalid commands that have been encountered in the current session. The message emitted by this command will be of the form:  ptor: !: X valid Y invalid where X and Y are the count of valid and invalid commands, respectively, that have been encountered so This count includes the ! command that is currently executing. The following is an example of this command in action:-bash-4.1$ ./ptor cmd:  R  /tmp/ktpg.svgptor:  R:  file  not  found cmd:  R  ~/tmp/ktpg.svg ptor:  R:  148915  0xec  2177 cmd:  x:  ~/tmp/ktpg.svg ptor: Invalid command cmd:  X:  /tmp/kipg.svg ptor:  X:  0x3acmd:  !ptor: !: 4 valid 1 invalid cmd:  exitptor:  terminating  with  status  1-bash-4.1$2 Submitting Your Program You must submit your program using cscheckin.  You must create and submit a Makefile with  your  source  code.   This  Makefile  will  be  used  to  build  your  program.   Please  place your code files and Makefile in a tar archive named hw4.tar.  Please do not compress your program using zip, gzip, winzip, winrar, or any other compression tool before or after mak- ing a tar archive for submission. When you have finished testing your program, please use cscheckin to submit the hw4.tar file to your instructor.3 Grading You must do your own work for this assignment. This is not a “team programming” exercise. All code submitted for this assignment must be entirely your own. Your program must use cooperating processes and behave precisely as specified in this assignment. Your program will be evaluated for completeness, clarity, efficiency, and compliance with the specified require- ments.

所有的编程代写范围: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++、数据结构代写、代写数据结构、数据结构代做、代做数据结构等留学生编程作业代写服务。