联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2018-06-17 03:44


System Programming Design LAB 2:

Inter-process Communication

May 17, 2018

1 Introduction

In practical computing system, it is important for processes to work in a collaborative manner

for the sake of computational speed, convenience or modularity. And the inter-process

communication mechanism is the key to let them communication with each other and synchronize

their actions. In this lab, we will investigate some topics of inter-process communication(IPC),

including message queue, pipe, shared memory and semaphore.

2 Message Queue and Full-Duplex Pipes in Unix

Message passing is one of the two major solutions for IPC. In this section, you need to compare

the performance of message queue and full-duplex pipe in Unix system. In the page 565

of the textbook, the performance of exchanging a specific amount of data is given. Then,

you need to implement the testing routine by yourself, try to reproduce the results and even

discover more features. Use the unix functions pipe, read and write for manipulating a

pipe and msgget, msgsnd and msgrcv for manipulating a message queue. Please refer to the

relative sections in the textbook for more descriptions about these functions.

The checklist for this section:

? a brief discussion of message queue and pipe in Unix system;

? your implementation of the testing routine(you can simply let a parent process communicate

with his child process);

? performance experiment results:

– for exchanging a specific amount of data (e.g. 100,000 calls and 200 megabytes of

data per call);

– other performance experiment results, e.g. how the time increases when data size

increases and the difference between message queue and pipe, etc.

Note: the relevant explanation for the experiment results will be a plus.

3 Shared memory and semaphore

Shared memory is another major solution for inter-process communication. In this section,

we will use semaphore to synchronize the reader and writer of a shared memory space. Basically,

the writer will write some data into the shared memory for the reader to read. You can

imagine that the reader and writer are working together to transfer a file or a data stream

1

through the shared memory. You must note: first, the reader and writer shall run in the

concurrent manner and be synchronized by semaphores; second, you must ensure that the

amount of data read from or written into the share memory is no more than 200 KB each

time. For simplicity, you could just allocate the shared memory space with the size same as

the total data needed to be transferred. But, to support transferring a file or data stream

larger than the allocated shared memory will be a plus.

The checklist for this section:

? your C implementation of the reader and writer;

? a brief description of your implementation;

? performance experiment results for the task of transferring files using your reader and

writer.

4 Handins

In this lab, you need to upload your implementation code and descriptive document for

each section to the FTP server. Please include the following points for each section in your

document:

? introduction about the topic, such as message queue, pipe, shared memory, semaphore;

? your code design, i.e. how you implement the experiment routine, the reader/writer

and the client/server;

? your performance experiment results and some analysis or explanations.

Deadline: 2018.05.31 23:59

Good luck!


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp