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

What are the three main activities of an operating system, What are the thr...

What are the three main activities of an operating system in regard to memory management? Keep track of which parts of memory are now being used and by whom. Decide which pr

Execution without entering a deadlock state, Q. Presume that a system is in...

Q. Presume that a system is in an unsafe state. Illustrate that it is possible for the processes to complete their execution without entering a deadlock state. Answer: An unsaf

Explain about interprocess communication, Explain about interprocess commun...

Explain about interprocess communication The cooperating processes communicate with each other via an interprocess communication facility. IPC gives a mechanism to permit proce

Dual mode operation, WHAT ARE THE ADVANTAGES AND DISADVANTAGES OF DUAL MODE...

WHAT ARE THE ADVANTAGES AND DISADVANTAGES OF DUAL MODE OPERATION OF OPERATING SYSTEM>?

What is an operating system?, What is an operating system? An operating...

What is an operating system? An operating system is a program that acts as a mediator between a user and the computer hardware. The function of an operating system is to provid

Discuss various services provided by the operating system, List and discuss...

List and discuss the various services provided by the operating system. Program execution - system capability to load a program into memory and to run it. I/O operatio

What is meant by file management systems?, What is meant by file management...

What is meant by file management systems? File Management systems are as well referred to as simply a file system .File system is the system that an OS operating system or prog

Major locking errors, When programming with threads, there are three very c...

When programming with threads, there are three very common mistakes that programmers often make: 1. locking twice (depending on the system and type of lock, can cause crashes, h

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