
C programming work -- 2
₹12500-37500 INR
Maksettu toimituksen yhteydessä
File Structure:
You will work with the provided producer_template.c and consumer_template.c source files. Rename them to producer.c and consumer.c after writing your code.
Do not modify the low-level functions for reading from and writing to shared memory; use the provided functions.
Compilation:
Compile your programs using the following commands:
Copy code
gcc producer.c -lrt -o producer
gcc consumer.c -lrt -o consumer
Producer Program:
Accept three command-line arguments as integers:
bufSize: Size of the bounded buffer (2 to 500).
itemCnt: Number of items to produce/consume (greater than 0).
randSeed: Seed for the random number generator.
Create a shared memory block with a fixed size of 4K, named OS_HW1_yourName.
Initialize the shared memory block's header with:
bufSize
itemCnt
in: Index of the next item to be produced
out: Index of the next item to be consumed
Fork a child process and load the consumer executable into it.
Use the Producer() function to generate random integers (5 to 2500) and write them into the bounded buffer. If the buffer is full, wait until the consumer consumes an item.
Consumer Program:
Open and map the shared memory block created by the producer, named OS_HW1_yourName.
Read the four integer values from the header.
Read all the items written by the producer to the shared memory buffer (itemCnt). If the buffer is empty, wait until the producer produces more items.
Coding Guidelines:
Follow the provided pseudo-code for bounded-buffer producer/consumer.
Use provided functions for reading and writing shared variables.
Utilize the GetRand() function for generating random numbers.
Projektin tunnus: #37251917
Tietoa projektista
19 freelanceria on tarjonnut keskimäärin ₹20500 tähän työhön
Hi, I have great experience in both C and C++ programming and software development for the Linux platform. I have lots of experience in multi threaded programming and multi processing and working with thread and Lisää
I am an experienced C/C++ developer. I have 3 years of experience in Linux system programming and the POSIX standard. Your task is easy to me. I believe I can help you in this task. Thank you.
Hii there , I can build your project. let me know more information about the project. so i can start project
Hello, I am a student from Serbia. I have great experience in C programming and in creating programs with multiple threads and working with fork() system call. I recently passed my operating systems class and I have ve Lisää
Hello client, I am a c programmer and developer for 2-3 years of experience. I can done this project very quickly. I understand that you want some experimental project. I have a team of 20 members. An Lisää
Hello there! My name is Anshavee and I am a C Programming freelancer with 1 years of experience helping clients. I understand that you are looking for someone to work on your C programming work - specifically file stru Lisää
Hii, I would like to take the initiative to create an advance project. I will make sure this visually looks good, professional and most importantly meet your brand guidelines. Here are the process which is very simple Lisää
Hello. I read your description carefully. As C/C++ developer with 15+ years experience, I am very interested in your project and am sure that I can make perfect result than others. I am very familiar with C and C++ a Lisää
Hi. I read the assignment requirements carefully. I am interested in working on such assignments. I have strong background on memory management in C and C++ and also developed similar projects during my bachelor studie Lisää
Hi Greetings! We are team of software developers. We have developers working on almost all the technologies. We will assign you a project manager who will assist you during entire process of project completion. We wil Lisää
Hello! I will perfectly complete your C programming work, based on my strong C/C++/C# Programming experience in 1 day. Please open the chat with me so that I can start working for you. Regards.