Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement two C programs in Unix that do the following: All these programs map a common file to memory, using mmap(). One program, called a

Implement two C programs in Unix that do the following:

All these programs map a common file to memory, using mmap().

One program, called a writer, repeatedly writes a string xxxxxxxxxx to the beginning of the memory mapped file in memory, where x is the last digit of the processs PID. The process pauses for two seconds (by calling sleep()) between writing. It terminates after writing the string 20 times. Since you always write from the first byte of the file, the processes repeatedly overwrite any previous data there.

You can start multiple writer processes concurrently.

The other program, called a reader, repeatedly reads the memory-mapped file, and displays its contents. The process pauses for two seconds between readings. It terminates after looping 20 times.

You can start multiple writer processes concurrently.

Run a few reader processes and write processes concurrently and observe the outputs.

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

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

1. Define mass and mediated communication

Answered: 1 week ago