C/C++ with Linux and Unix commands

En curso Publicado hace 7 años Pagado a la entrega
En curso Pagado a la entrega

Message Passing and Operating System Simulator

In this project you will be creating an empty shell of an OS simulator and doing some very basic tasks in preparation

for a more comprehensive simulation later. This will require shared memory and some message passing.

Operating System Simulator

This will be your main program and serve as the master process. You will start the operating system simulator

(call the executable oss) as one main process who will fork multiple children and then fork o new children as some

terminate.

oss will start by rst allocating shared memory for a clock that only it will increment. The child processes should be

able to view this memory but will not increment it. This shared memory clock should be two integers. One integer

to hold seconds, the other integer to hold nanoseconds. So if one integer has 5 and the other has 10000 then that

would mean that the clock is showing 5 seconds and 10000 nanoseconds. This clock should start at 0.

With the clock at zero, oss should then fork o the appropriate number of child processes. Then it should enter into

a loop. Every iteration of that loop, it should increment the clock (simulating time passing in our system). While in

this loop, oss should be waiting for messages from its children. When sent a message, it should output the contents

of that message (which should be a set of two integers, a value in our clock) to a le. The master should then fork

o another child. This process should continue until 2 seconds have passed in the simulated system, 100 processes

in total have been generated or the executable has been running for the maximum time alloted. At that point the

master should terminate all children and then itself.

Note that I did not specify how much oss should increment the clock on each iteration. This will depend on your

implementation. Tune it so that your system has some turnover.

The log le should look as follows:

Master: Child pid is terminating at my time [url removed, login to view] because it reached [url removed, login to view]

Master: Child pid is terminating at my time [url removed, login to view] because it reached [url removed, login to view]

Master: Child pid is terminating at my time [url removed, login to view] because it reached [url removed, login to view]

...

User Processes

The child processes of the oss are the user processes. These should be a separate executable from master, run with

exec from the fork of oss.

This process should start by reading the system clock generated by oss. It should then generate a random duration

number from 1 to 100000. This represents how long this child should run.

It should then loop continually over a critical section of code. This critical section should be enforced through the

user of message passing and msgsnd and msgrcv.

In this critical section of code done using message passing, the user process should read the oss clock until that

duration has passed. If while in the critical section it sees that its duration is up, it should send a message to oss

that it is going to terminate. Once the child knows that master received the message, it should terminate itself. The

message sent to oss should consist of the current oss system clock time that it decided to terminate on.

Programación en C Linux UNIX

Nº del proyecto: #12492409

Sobre el proyecto

3 propuestas Proyecto remoto Activo hace 7 años

3 freelancers están ofertando un promedio de $107 por este trabajo

cracken

Hi, I am competitive to this kind of task, can take good care of this project. In fact, I already done related to this job before. Let me know the best of your time so we can discuss further based on your requirements Más

$99 USD en 0 días
(15 comentarios)
4.4
skriyaz09

A proposal has not yet been provided

$110 USD en 6 días
(0 comentarios)
0.0