Assignment on Fork System Call, Operating System

Assignment Help:
Parent process P creates three child processes, C1, C2, and C3. Each child process executes a
memory and CPU intensive application of your choice. Your choice should be such that the children
execute for considerable periods of time and acquire considerable amount of memory (say, on the stack
or on the heap).
The parent process P wants to periodically monitor the status of its children to determine: • are each of the three children, C1, C2, and C3 alive? • what is the CPU utilization of each child process? • what is the memory usage of each child process?
Note that P received the PIDs of C1, C2, C3, during the fork() system call. In order to obtain the
periodic status, P does the following:
(a) It periodically forks a child, M, creates a pipe with it, and redirects the standard output of M to
the pipe (that is, when M writes to stdout it can be read by P from the pipe). The monitoring
interval can be implemented with the sleep command.
(b) Once M is created, it chooses a suitable system call from the exec family to execute the “ps”
command with suitable arguments (thereby writing its output into the pipe with its parent P).
Thereafter M terminates.
(c) P reads the output of M from the pipe, finds the entries corresponding to C1, C2, and C3 (that
is, if they are alive) and extracts their respective CPU and memory utilizations (in percentage,
as reported by “ps”). P writes the timestamp and the information extracted in the terminal.
(d) When P finds that C1, C2, and C3 are not present in the listing of “ps”, it writes “All children
have terminated” and stops.
Please study the syntax and arguments of “ps” carefully so that you execute it with the optimal set of
arguments.
You need to submit the following:
1. The C program for P
2. The applications run by C1, C2, C3. These must be made available in a form that the TA can
run your system in your absence

Related Discussions:- Assignment on Fork System Call

Crank-nicolson timestepping schemes, For the heat conduction problem, inves...

For the heat conduction problem, investigate the effects on the numerical solution of the following aspects: 1. non-uniform meshes with re?nement at both ends versus a uniform m

Explain the various page replacement strategies, Explain the various page r...

Explain the various page replacement strategies. Page replacement-basic scheme with diagram Optimal page replacement LRU page replacement FIFO page replacement LRU

Explain benefits of time-sharing system, Under what circumstances would a ...

Under what circumstances would a user be better off using a time-sharing system, rather than a personal computer or single-user workstation? When there are some other users, th

Difference between the vfork() and fork() system call, In the mean while th...

In the mean while the fork() system call the Kernel creates a copy of the parent process's address space and adds it to the child process. But the vfork() system call do no

What are the different constituents of a process, Problem: a) Define th...

Problem: a) Define the term ‘process' and what are the different constituents of a process. b) In the three-state process model, what does each of the three states signify?

Is it essential to bind a real-time thread to an lwp, Q. Presume an operati...

Q. Presume an operating system maps user-level threads to the kernel using the many-to-many model and the mapping is done through LWPs. Additionally the system allows developers to

List five services provided by an operating system, List five services prov...

List five services provided by an operating system. Explain how each provides convenience to the users. Explain also in which cases it would be impossible for user-level programs t

Hardware and software requirements for virtual memory?, What are the hardwa...

What are the hardware and software requirements for virtual memory? The hardware required for virtual memory is a secondary memory and page table. The page table should have th

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd