Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please provide the right / perfect code. Do mention all the information required Task In this project you will be writing a makefile to compile
Please provide the rightperfect code. Do mention all the information required
Task
In this project you will be writing a makefile to compile two source files into two separate executables. One of the executables will be called oss, generated at least partially from the source file oss.c The other executable will be called user, generated at least partially from the source file called user.c
The user executable is never executed directly. Instead, oss will be launching that executable at various times.
Note you MUST have a makefile that compiles and creates these executables at the same time. This will require the use of the
all command in your makefile to compile multiple executables from the same makefile.
keep in mind that executables will never be called by itself directly though you
can do so to test
User process the children The user takes in one command line argument. For example, if you were running it directly you would call it like:
user
As it is being called with the number it would do iterations over a loop.
So what does it do in that loop? Each iteration it will output its PID, its parents PID, and what iteration of the loop it is in For example, suppose its PID is its parents PID is and it is the rd iteration of the loop, it would output:
USER PID: PPID: Iteration: before sleeping
After doing this output, it should do sleep to sleep for one second, and then output:
USER PID: PPID: Iteration: after sleeping
You should test this by itself, but it will not be called by itself normally.
Linux System Calls oss the parent
The task of oss is to launch a certain number of user processes with particular parameters. These numbers are determined by its own command line arguments.
Your solution will be invoked using the following command:
oss hn procs simult iter
The proc parameter stands for number of total children to launch, iter is the number to pass to the user process and the simul
parameter indicates how many children to allow to run simultaneously.
For example, if I wanted to launch oss such that it would launch user processes, never allow more than to be running at the
same time, and then have each of the users do iterations, it would be called with:
oss n s t
If called with the h parameter, it should simply output a help message indicating how it is supposed to be run and then
terminating.
So now that I know what parameters it should run with, what should it do oss when launched should go into a loop and start
doing a fork and then an exec call to launch user processes. However, it should only do this up to simul number of times. In
our above example, we would launch no more than initially. The oss would then wait until one of the children had finished
before launching another.
Implementation details
It is required for this project that you use version control git a Makefile, and a README. Your README file should consist,
at a minimum, of a description of how to compile and run your project, any outstanding problems that it still has, and any
problems you encountered.
Your makefile should also compile BOTH executables every time. This requires the use of the all prefix.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started