Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CMP SCI 4760 Operating SystemsProject # 1 Due Date: Feb 7th, 2023 Important: Please do all projects on hoare Skeleton multiple processes Purpose This is

CMP SCI 4760 Operating SystemsProject # 1 Due Date: Feb 7th, 2023 Important: Please do all projects on hoare

Skeleton multiple processes

Purpose This is your warm up project building on your knowledge from CMPSCI 2750. The goal of this project is to become familiar with the environment in hoare while creating a setup for future projects. Additionally, you should understand the different steps of compilation and linking, and creating your executable.

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 worker, generated at least partially from the source file called worker.c. The worker 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. We will first discuss what the worker executable does, but keep in mind that it will never be called by itself directly (though you can do so to test). worker, the children The worker takes in one command line argument. For example, if you were running it directly you would call it like: ./worker 5

As it is being called with the number 5, it would do 5 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 6577, its parents PID is 6576 and it is the 3rd iteration of the loop, it would output: WORKER PID:6577 PPID:6576 Iteration:3 before sleeping After doing this output, it should do sleep(1), to sleep for one second, and then output: WORKER PID:6577 PPID:6576 Iteration:3 after sleeping You should test this by itself, but it will not be called by itself normally.

Linux System Calls 2 oss, the parent

The task of oss is to launch a certain number of worker processes with particular parameters. These numbers are determined by its own command line arguments. Your solution will be invoked using the following command: oss [-h] [-n proc] [-s simul] [-t iter] The proc parameter stands for number of total children to launch, iter is the number to pass to the worker 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 5 worker processes, never allow more than 3 to be running at the same time, and then have each of the workers do 7 iterations, it would be called with: oss -n 5 -s 3 -t 7 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 worker processes. However, it should only do this up to simul number of times. In our above example, we would launch no more than 3 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.

Linux System Calls 3 Criteria for success Please follow the guidelines. Start small, implement one functionality, test. Do not wait until the last minute and contact me if you are having issues.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions