Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C LANGUAGE Socket Labwork You are required to write a server-client network system that will implement producer-consumer problem. Here are some directions to follow:

IN C LANGUAGE
Socket Labwork
You are required to write a server-client network system that will implement producer-consumer problem.
Here are some directions to follow:
1) You are required to create a server program , producer clients program and consumer clients program.
2) Your server will listen clients at port 1500 and accept the consumers and producers.
3) If a client will be a consumer, your server will create a consumer thread and start to interact
with this client using this thread.
4) If a client will be a producer, your server will create a producer thread and start to interact
with this client using this thread.
5) Here the consumer thread will implement the consumer routine and producer thread will
implement the producer routine infinitely. The server will supply a fixed size buffer for the
operation. The size of the buffer is going to be entered as a console argument.
6) Threads created by the server will be synchoronized by POSIX semaphores.
7) After a thread will do consume or produce operation, it will send the status of the buffer to
the client which it interacts with.
8) Producer clients program will want number of producers as a console argument. Then, this
program will fork producer client processes.
9) Consumer clients program will want the number of consumers as a console argument. Then,
this program will fork producer client processes.
10) Every client process will connect to the port 1500 and the local machine address 127.0.0.1.
Each process must specify its type (i.e. producer or consumer) and send it as a message to the server machine. These processes are going to wait buffer status messages from the server machine.

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

Step: 3

blur-text-image

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

Transactions On Large Scale Data And Knowledge Centered Systems Iv Special Issue On Database Systems For Biomedical Applications Lncs 6990

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Christian Bohm ,Johann Eder ,Claudia Plant

2011th Edition

3642237398, 978-3642237393

More Books

Students also viewed these Databases questions