Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Operating System spring 2019

Assignment # 1
Due date: Sunday 19 May 2019 11:59 PM
Topic: Process creation and Inter-Process communication using named Pipes (fifo)
Submission Guidelines: submit your source files to course canvas group before deadline, copied submissions
will be graded as ZERO. Properly format/comment your error free code before submission.

Question # 1

Write a program named my_command_executor with following requirements. Program should


accept command line arguments separated by space. Each Argument would be a Linux command
etc ls, whoami etc. Your program should be able to run using the following syntax:

./my_command_executor ls whoami ls pwd time.

The program should be able to spawn a new child for each command and execute it also
maintain a history file that logs the usage of the program.

The log file Should look like as follows:


08-05-2019:13:02:55 /my_command_executor ls whoami.
08-05-2019:13:02:59 /my_command_executor pwd whoami.
08-05-2019:13:04:02 /my_command_executor ls whoami ls pwd.
08-05-2019:13:06:55 /my_command_executor pwd.

You should not hard code the Linux commands in your program
Question # 2
Implement following scenario given below using named pipes (FIFO), where several client
processes and one server process want to communicate with each other.
Server should be in listening state infinitely to client’s messages received in its server fifo and
replying to each message. Clients are also in listening state infinitely to server messages received
in its client specific fifo and in response they must reply to server. Use sleep function for 1 sec
inside server loop and any number of clients can join on run time.

You might also like