Program - Process and thread creation

Assignment Help C/C++ Programming
Reference no: EM132229848

Operating Systems Assignment - Process/thread creation and inter-process communication

Goals

Practise:

1. process creation in Linux using fork() and exec() system calls

2. thread creation in Linux with the pthread API.

3. inter-process communication using pipes.

Description - Two programs have been provided: user.c and server.c. Your task shall be to complete these two programs such that the execution of the program user creates four processes as follows:

1. User process: this is the original process invoked when user is run. It is responsible for creating the other three processes after which is simulates User that exchanges messages with Bot (simulated by the Bot process).

2. Bot process: this is a child process of the User process that simulates Bot who exchanges messages with User.

3. User Server process: This process (that runs the server program) provides a server service that services the User process. It shall use one thread to read text messages from its standard input which is then send to a communications channel to the Bot process. A second thread is used to send to its standard output any text messages received from the Bot process over a communications channel.

4. Bot Server process: This process (that runs the server program) provides server service that services the Bot process. It shall use one thread to read text messages from its standard input which is then send to a communications channel to the User process. A second thread is used to send any text messages received from the User process over a communications channel to its standard output.

5. Message Flow: User sends the first message and Bot responds with two messages(two options).User selects one and Bot sends Another two options and so on...

The user program is designed to test the server program by simulating a User and a Bot that exchange a sequence of text messages. Four pipes are used as shown below: two pipes allow the User and Bot processes to send messages to the standard inputs of the User Server and Bot Server processes respectively. Two other pipes are used as the communication channel between the Servers. The User process that spawns the Server processes creates the pipes and passes the file descriptors of the communication channel pipes to the server programs.

The pipe identifiers and process identifiers (PIDS) shown in the above diagram are specific to a run and correspond to the identifiers shown in the output of item 4 in the section "Background Information". All standard error file descriptors (2) and the standard outputs of the Server processes are connected to the terminal. The path of messages from Bot process is shown (a similar path is taken for messages from the User process).

To complete the assignment:

1. Start with the provided files user.c and server.c. Complete the documentation in each file to indicate your name and student number. Take the time to document well your code. Consider taking the time to design your code before you start coding.

2. Complete the following functions:

a. user.c: setupBot(),initUserServer(),

initBotServer(),setupUser()

(also complete main to have these functions run properly)

b. server.c: generateThreads()

3. The programs should be compiled using the commands "cc -o user user.c" and "cc -o server server.c -lpthreads" (note that for server compilation, the pthreads library must be explicitly specified). The file makefile has been provided to compile both files - simply type in the command make.

4. To submit the assignment, upload the files user.c and server.c. Do not forget to click on the submit button after (and only after) you have uploaded the file.

5. A word of caution, for debugging the programs, if you wish to write messages to the terminal, you should write to the standard error using the following library call: fprintf(stderr,"message string\n") as the standard input and standard output are to be modified.

6. See point 4 in "Background Information" (attached) for hints on how to observe processes/threads and pipes to help debug your programs.

7. When user is run, the following output should appear on your screen (Note that PIDs shall be specific to your execution).

Note - Just need the codes.

Attachment:- Assignment Files.rar

Reference no: EM132229848

Questions Cloud

Considering manufacturing their own brand of pool cues : Farris Billiard Supply sells all types of billiard equipment and is considering manufacturing their own brand of pool cues.
Describe technology drivers of it infrastructure evolution : Describe the technology drivers of IT infrastructure evolution?
Conduct a psychosocial needs assessment for the patient : For this assignment, read the following scenario and conduct a Psychosocial Needs Assessment for the patient during an Intake Assessment.
Demographic-psychographic segment of the market is target : In this assignment you will evaluate a billboard advertisement for any business. What demographic/psychographic segment of the market is the target?
Program - Process and thread creation : CSI3131 Operating Systems Assignment - Process/thread creation and inter-process communication. Process creation in Linux using fork() and exec() system calls
How your study would contribute to positive social change : Briefly describe the study you would like to conduct, including the characteristics of the participants in your sample (e.g., age, gender, race/ethnicity).
Besides severity and probability of occurrence : Besides severity and probability of occurrence, what additional parameter does an RPN analysis consider?
How the process is portrayed through books and movies : Give one example of how caregivers influence their children's language development. Your inspiration for this reflection might be from your own observations.
Explain understanding of supported and unsupported models : Explain your understanding of supported and unsupported models used in making important decisions in ethics and life. (For example: The eight-step model).

Reviews

len2229848

2/7/2019 9:24:08 PM

Just need the codes. You must submit your assignment on-line with Virtual Campus. This is the only method by which we accept assignment submissions. Do not send any assignment by email. We will not accept them. We are not able to enter a mark if the assignment is not submitted on Virtual Campus! The deadline date is firm since you cannot submit an assignment passed the deadline. You are responsible for the proper submission of your assignments and you cannot appeal for having failed to do so. A mark of 0 will be assigned to any missing assignment.

len2229848

2/7/2019 9:24:01 PM

Assignments must be done individually. Any team work, and any work copied from a source external to the student (including solutions of past year assignments) will be considered as an academic fraud and will be forwarded to the Faculty of Engineering for imposition of sanctions. Hence, if you are judged to be guilty of an academic fraud, you should expect, at the very least, to obtain an F for this course. Note that we will use sophisticated software to compare your assignments (with other student's and with other sources...). This implies that you must take all the appropriate measures to make sure that others cannot copy your assignment (hence, do not leave your workstation unattended).

len2229848

2/7/2019 9:23:56 PM

Grading criteria; Compiles and runs correctly by fulfilling the conditions below [100pts]. If any of the points below fail to be implemented; 5 points will be deducted for each non-implemented part. If does not compile and/or run correctly; the conditions below will be checked individually: Setting up user and bot, Setting both the severs correctly, Connection between the user server and user (bot server and bot) and Generating threads and in order execution of threads.

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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