Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Implementing the Command: Status pid pid pid

Exercise Requirements

There are 18 marks on this makeup.  You have 2 weeks from receipt to complete it.  A 60% is required for a passing grade.  All code should be documented and you should provide a status report and testing demonstrating that each exercise works.

1. Implement the command: status  pid  pid  pid pid .

The status for each process on the system can be found in the 2nd line of the file /proc/pid/status.   Try this out for your current bash shell:

cat /proc/$$/status   

You can only look at the status of commands that you own.

Have status  the status of each of the pids listed.  If the pid does not exist this should be reported.  If it exists but you are not allowed to read it this should be reported too.  (1)

Test the following cases  - you should have a program from earlier in the term for each case.   If you don’t, it’s time you created one:  (3  -  ½ for each test)

i. A process that is sleeping.   

ii. A process that is running  (the pid of the forking shell itself qualifies)

iii. A process that is a zombie

iv. A process that is an orphan

v. A process you do not own.  

vi. A process that does not exist.

2. Signals and File Descriptors

The file  consists of a small number of binary records of type struct PERSON created by the program createPeople.c  compiled using -fpackstruct.  Assume that the actual number of records is unknown at compile time.  For the following exercise modify  and test a program using signal handlers and file pointers (not file descriptors) to do the following.

a. Create and test a signal handler for SIGUSR1 that displays a random record from the file.

b. Create and test a signal handler for SIGHUP that appends a record to the end of the file, rereads it from the file and reports on the new file size. 

c. Create and test a signal handler for SIGUSR2 that displays the record previous to the last one displayed.   If no records have been displayed yet select the last record in RomarioDB.  If the last record displayed was the 1st one simply report that  there are no previous records.

3. Maniplulating times,  using  exec 
Create a file to schedule the running of several programs with parameters.  For testing purposes keep the times close together.  About 3 entries should do.  The times should be in sequential order.  Replace prog1, prog2 and prog3 with programs written during the course.

        13:15:21 May 27, 2020   prog1   arg1 arg2   arg3
        13:15:23 May 27, 2020   prog2   arg1  arg2  
        13:15:29  May27, 2020   prog3    arg1  arg2  arg3 arg4  arg5

One of the programs listed should be a forever loop.  Another can be a regular bash shell command.  

a. Write a program update min secs   which updates the times in the file.  (This will save you the effort of manually editing the file.

b. Write a program that outputs the current date and time and when the 1st job is scheduled.   Set an alarm so that the first job is run as a child using execvp at the appropriate time.  Do not wait for the child, yet.

c. When the 1st child is launched schedule an alarm for the next child and then run it.  Repeat until there are no more commands to be run

d. After the last program is executed go into a 2nd loop.  Wait for the children to finish and report both their exist code and the signal used to terminate them.  

In a second terminal send a signal to your program with the forever loop, terminating it.

support
Whatsapp
callback
sales
sales chat
Whatsapp
callback
sales chat
close