Establish shared-memory object between parent and child

Assignment Help Operating System
Reference no: EM13707307

Question: In previous, the child process must output the sequence of numbers generated from the algorithm specified by the Collatz conjecture because the parent and child have their own copies of the data.

Another approach to designing this program is to establish a shared-memory object between the parent and child processes.

This technique allows the child to write the contents of the sequence to the shared-memory object. The parent can then output the sequence when the child completes. Because the memory is shared, any changes the child makes will be reflected in the parent process as well. This program will be structured using POSIX shared memory. The parent process will progress through the following steps:

Part a: Establish the shared-memory object (shm open(), ftruncate(), and mmap()).

Part b: Create the child process and wait for it to terminate.

Part c: Output the contents of shared memory.

Part d: Remove the shared-memory object.

One area of concern with cooperating processes involves synchronization issues. In this exercise, the parent and child processes must be coordinated so that the parent does not output the sequence until the child finishes execution.

These two processes will be synchronized using the wait() system call: the parent process will invoke wait(), which will suspend it until the child process exits

You need to establish a shared-memory object between the parent and child processes. Provide the answer of given question and also give details.

Reference no: EM13707307

Questions Cloud

Write a c function called bspline : Write a C function called Bspline that takes as input a single double precision argument called x. The function returns a double precision value y determined as given
Implement the link list using java programming concepts : Modify the class LinkedList by adding to it the following methods. The appropriate error message should be generated if an invalid condition occurs.
Create a structure named dog with a string field : Create a Structure named dog with a string field for the Dog's name. Create a Structure named Cat with a string field for the Cat's name.
Prepare an overloaded constructor : Prepare an overloaded constructor that provides values for each field. Also provide get methods for each field. Save the file as Patient.java.
Establish shared-memory object between parent and child : the child process must output the sequence of numbers generated from the algorithm specified by the Collatz conjecture because the parent and child have their own copies of the data.
Write a program to implement a linear linked list : Write a C/C++ program to implement a singly linear Linked List
Function that will accept the three sides of a triangle : Create a function that will accept the three sides of a triangle (a, b, c) as scalar values, calculate the angles that correspond to these sides (alpha, beta, gamma), and return these angles to the function call in the script file.
Determine the total resistance of a number of resistors : Prepare a function that will determine the total resistance of a number of resistors that are connected in parallel.
Prepare a c program using the fork() system call : Perform required error checking to ensure that a positive integer is passed on the command line - Prepare a C program using the fork() system call that generates this sequence in the child process. The starting number will be provided from the comm..

Reviews

Write a Review

Operating System Questions & Answers

  Describe a client or server protocol used in everyday life

Suppose a time-sharing operating system allocated time slices of 20 milliseconds and the machine executed an average of 5000 instructions per microsecond. How many instructions could be executed in a single time slice?

  Operating system as it is running on computer system

The following four requests could come in to the operating system as it is running on computer system: Clock in computer has just "ticked", and we require to update seconds counter.

  Consider a small take-out food restaurant called burrito

consider a small take-out food restaurant called burrito brothers. this very popular establishment offers a very-tasty

  Identity top level objects of the microwave

Construct a table with the following four column headings, Top Level Objects, Communicates With, Incoming Messages, and Outgoing Messages and Identity top level objects of the microwave.

  What are the states and what are the productions

Describe how the problem of traveling from one city to another could be framed as a production system. What are the states? What are the productions?

  Stateful inspection packet filtering routers

Name two benefits of Stateful Inspection Packet Filtering Routers. Name two benefits that firewalls add to a network

  Primary keys of the entities

Determine what would be an example scenario for a database. What entities would be involved? What would the primary keys of each of entities be and explain your answer?

  Autonomous intelligent software agents are used in

autonomous intelligent software agents are used in artificial intelligence to solve an increasing number of complex

  How does interpretation differ from compilationwhat is the

1. how does interpretation differ from compilation?2. what is the difference between the logical description of a file

  Frequency definition of bandwidth

In data communication we often use term "bandwidth" when we refer to capacity of a link. Strictly speaking, however, bandwidth refers to range of frequencies that can be carried on a link.

  Standard forms, mdi parent forms and mdi child forms

Explain the similarities and differences between standard forms, MDI parent forms, and MDI child forms in an MDI application. How is each type of form created?

  Combining global variables and functions

The parameter list is the normal means to supply values to a function. Global variables are an alternate means for a function to have access to values.

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