Assignment Task
Purpose
To develop a synchronous inter-process communication through the use of both fork(), pipe(), and exec() system calls. For this exercise only ordinary pipes are to be used.
What to Do
You are to develop a producer/consumer application. Both the C programming language and any distribution of the Linux operating system are to be used. Your solution must be structured as a set of services. The core service is the inter-process communication which it is referred here as the producer/consumer service.
Details
A synchronous producer/consumer pair of processes is to be created to support the service of replacing all lowercase letters in a set of strings of characters with their uppercase correspondent. The service above described will require support of a set of other services to perform
1. The encoding and decoding of the data,
2. To change lowercase letters into uppercase,
3. To open and close files,
4. To include and verify parity bits,
5. To read from pipes, and
6. To write to pipes.
Both the standard ASCII character set and odd bit parity are to be used. All data communications between producer and consumer are to be done by reading and writing through two shared pipes. The data generated by the producer is encoded and shared with the consumer through one pipe.
The consumer decodes the message, modifies it, encodes it, and shares it with the producer through the second pipe. You are to create a library to support your producer/consumer process activities. The file “encDec.h” is to be created and it must contain the prototypes of all code required to support the producer/consumer activities as described by the services provided by the three layers discussed below. All access to the services provided by this library must be done only through the use of any of the members of the exec() family of system calls. The three distinct layers to be created
1. The physical layer must contain routines to handle tasks such as
a. Converting a character into a binary bit pattern,
b. Converting binary patterns into characters,
c. Including a parity bit, and
d. Checking and removing the parity bit.
2. The data link layer must contain routines for
a. Framing (putting two SYN characters, a LENGTH character, and data into a frame), and
b. Deframing (separating control characters from data characters).
The Consumer
Reads all encoded frames through the pipe used by the producer to transmit data, deframes the data received, checks and removes parity bit, decodes the dada obtained, converts all lowercase characters to uppercase, encodes the converted characters, adds the parity bit, creates all needed frames, stores the resulting information in a file (.chck), and uses a pipe to share the encoded result with the producer.
Important Tasks
The following are the fundamental tasks to be done for this project:
- Create the C files needed for each of the three layers. Compile them and create your “encDec.h” file with the prototypes of all functions needed to provide the services defined by each of the three layers.
- Create the consumer/producer application, as discussed in this document, that uses two shared pipes for communication. Your consumer/producer application must contain the statement including “encoded.h”
- Create and populate the filename. inpf. This file will contain all the original data to be shared between producer and consumer.
- Create the filename. bind. This is the binary (0’s and 1’s) version of the original data. This will help you check the correctness of your conversion module. This file is created by the producer, shared with the consumer through the pipe, and processed by the consumer.
- Create the filename. out. This is the modified version of filename.inpf where all lower case letters have been replaced by upper case letters. The consumer is responsible for the creation of the filename. out.
- Create the filename. check. This file is the encoded version of a filename. out with a parity bit and frame included.