Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

Cs 149 sjsu

16/11/2020 Client: arwaabdullah Deadline: 3 days

When a UNIX-like system starts up, it runs init. Nowadays this is a program called systemd on UNIX-like systems. On Mac the similar system manager is called launchd. It runs under PID of 1 and is an ancestor of all other processes. You can see the process with command "ps aux". If a process is left as an orphan (its parent dies), it gets reassigned as a child of PID 1. These service programs (init, systemd or launchd) are running in the background; on UNIX-like OSs these are commonly referred to as daemons and generally have names ending with the letter “d.” These programs ensure that things start up properly and stay running. If a process crashes systemd (or launchd) can detect this and start it back up.
You will develop a proc_manager program that reads in the commands to execute from an input file one-by-one. You will read one command and its parameters per each line. Then the proc_manager program will start up the process and "babysit" it.You will run each command in a child process using exec (or one of its variants) and the parent process will wait for each exec to complete. For each child process there will be log messages written to output and error files, which are named after its index in the sequence of commands read in. For example, process #1 will have logs written to 1.out and 1.err. Upon start, the string "Starting command INDEX: child PID pid of parent PPID" will be logged to the corresponding output file 1.out. You can retrieve PID and PPID through the return value of fork() or getpid() or getppid().You can use dup2() to make file handle 1 (stdout) go to a file X.out and handle 2 (stderr) go to a file X.err. Note: new executions of a command should append to the previous output and error files, such as 1.out, rather than overwrite them.
Timer for each process: you can include the timer.h library and use timer to record the start time of spawning each child process in the parent. Upon finish of an exec (either a successful finish or termination via a signal), the process should record the finish runtime, and it should write to the output file the string "Finished at FIN, runtime duration DUR" where FIN is the finish time and DUR is the duration of the execution.
Each time a process finishes, the message "Exited with exitcode = X" should be written to the error file of the process. X is the process exit code. If the process was killed with a signal, then "Killed with signal S" should be written to the error file. S is the signal number that killed the process. This information is gathered using the status parameter of the wait() system call. If the program cannot be started (exec fails), use perror("name of command") to get the error message and command name and write them to the command's error file. Processes that encounter an invalid command (exec fails) should have an exit code of 2. Remember the exit code of 0 indicates success. Exit codes other than 0 indicate some failure, including a termination via a kill signal.Here is an example run:

./proc_manager cmdfile
Where cmdfile contains:

prompt> cat cmdfile

sleep 5

ls -latr

pwd

sleep 1

wc /etc/passwd
The parent will re-start the executable if the command took more than two seconds to complete. Therefore, a process restarts as long as its last execution took more than 2 seconds. If a process completed within less than 2 seconds after starting, proc_manager will not restart it and will print a message "spawning too fast" to the error file for the process. If it was terminated by a signal right after it started, or it had some other failure that caused it to exit immediately, it won't restart, since it exited immediately.
proc_manager runs until there are no more processes running. In this example the ls and wc commands won't get restarted because they finish right after they are started. The sleep runs for 3 seconds, so proc_manager will keep restarting it, unless we do "pkill sleep" in another terminal. If we do pkill fast enough, proc_manager will detect the quick duration and exit and not restart it. If any process has no child process then wait() returns immediately "-1", thus you can continue until wait() returns -1.

Grading
code compiles without errors or warnings -Wall on VirtualBox10%

correctly uses fork()10%

correctly uses wait*()10%

correctly uses dup2()10%

a version of exec is used correctly10%

the exit and signal codes and spawning messages are printed correctly10%

all processes run in parallel10%

an output and error file is created for each command10%

code is commented and indented (use of white space)10%

zip file contains proc_manager.c10%

Submission
Upload a zip file called proj3.zip that contains your source files that are needed to compile and run on VirtualBox (including proc_manager.c).

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Buy Coursework Help
Peter O.
Quality Homework Helper
Writer Writer Name Offer Chat
Buy Coursework Help

ONLINE

Buy Coursework Help

Hi dear, I am ready to do your homework in a reasonable price.

$62 Chat With Writer
Peter O.

ONLINE

Peter O.

Hello, I can assist you in writing attractive and compelling content on ganja and its movement globally. I will provide with valuable, informative content that you will appreciate. The content will surely hit your target audience. I will provide you with the work that will be according to the needs of the targeted audience and Google’s requirement.

$55 Chat With Writer
Quality Homework Helper

ONLINE

Quality Homework Helper

Hi dear, I am ready to do your homework in a reasonable price.

$62 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

General motion examples in sport - A plastic ocean worksheet - Add cname crazy domains - Supervision concepts and practices of management 13th edition pdf - Grasslin uk ltd tonbridge kent - Define the following terms answer - Game management authority act - Chemistry final exam answer key - What type of innovation is the milo sensor wristband - Advanced placement economics microeconomics student resource manual answers - Use the mesh-current method to find the magnitude of the total power developed in the circuit. - 390.10 - Mckesson hr - Mistaken identity a ten minute play pdf - True individual freedom cannot exist without economic security and independence - Tiger initiative - What does parq stand for in pe - Billabong ranch echuca vic - Sanctions imposed on attorneys for overbilling clients - Htpp learn genetics utah edu content labs gel - 2 methylbutane reacts with chlorine - Internal Theft: Instituting Package Control Procedures to Protect Organization Assets - 5 star writing checklist - Outsider pressure groups examples - GHF D5 - Wafer bumping process flow - Bs en 60079 part 10 - Competency based recruitment and selection ppt - Journal Article Summary 4 - Short circuit capacity 3871 type 2 - BLACK OUT SUMMER 1977 - Burger king strengths and weaknesses 2018 - Professional interview - Matrix reloaded architect speech - 1 6 journal from problem to persuasion - R v katarzynski [2002] nswsc 613 - 145 hook creek blvd terminal a7 valley stream ny 11581 - Oprah winfrey harvard commencement speech transcript - The new christian counselor - Segway human transporter ppt - Centrelink student payment $1000 - Reverend parris reputation in the crucible - Assignment 3 government - Hutton rudby parish council minutes - What is 3 of 15.45 - Tax prep 1 tax course 101 final - Question daniel or confront brett - Enter the november 1 balances in the ledger accounts - Piece of flash fiction 2 - Online Love Problem Solution Baba ji +917657874622 - Applying psychology to everyday life essay - Cellular respiration experiment with yeast and balloons - Nanda diagnosis for pulmonary embolism - HR Strategic Planning, HR Recruitment Tools - Re-interpret Eve - Book of Genesis - Sci 220 week 2 food intake - Dulux chalkboard paint instructions - Case ih 1660 combine grain tank capacity - D2 - Girfec 5 key questions - NEED 3+ PAGES WITH 4 PEER REVIEWED REFERENCES CITED IN APA FORMAT - Clayton hotel zhengzhou standard - Negotiator ep 38 eng sub - Romeo and juliet mercutio - 2 year old observation paper - Shimizu mega city pyramid - OperationsManagementForLeaders_Assessment1 - Ph of acid base mixture - Hr case study scenarios worksheet answers - Disc 363 leadership competency review - Acc 202 final project part i budget variance report submission - World Civilization before 1650. time traveler - 4 day ppl split - Cost effective - Proos roofing supplies porth - River avon boat licence - Research Paper - Kiwi dna extraction lab - Book Review - Bruce stevenson toyota launceston - Gate turnaround at southwest airlines - Actron air conditioning warranty - Borderlands 2 caustic caverns undiscovered challenge - 7x 3 5x 2 3x 1 - A feasible solution violates at least one of the constraints - 1 page only- deliver in 10hrs - Sl power electronics ltd - Steps included in the ethical reasoning process - Njb basketball las vegas - Qrb 501 quantitative reasoning for business final exam - Maurice j gallagher jr - Hypertrophy training program pdf - 24/7 gatorbait message board - Hiscox guide for baptist churches pdf - What is the magnitude of the electron's acceleration - Home work 3 - Alaska fly fishing expedition risk assessment - Biology - Effect of chemical germicides on bacterial growth - Research design and methods