Starting from:
$30

$24

CSC Lab 4: Working with Process Solution

PART 1 Simple Command Interpreter

Write a special simple command interpreter that takes a command and its arguments. This interpreter is a program where the main process creates a child process to execute the command using exec() family functions. After executing the command, it asks for a new command input ( parent waits for child). The interpreter program will get terminated when the user enters exit.


Example:

./interpreter

command: pwd

    • output command: ls -la
    • output command: date
    • output

command: ls -lr /foldername

    • output

command: tail /etc/passwd | grep username

    • output

command: ps -u username | grep firefox

    • output

command: cat /etc/passwd

    • output command: exit
    • terminates the program.


Marks: 15
PART 2 Average Grade Calculator

There are n (n>1) students enrolled in a course. The course covers x number of chapters from a textbook (x > 1).

In each chapter y number of homeworks are assigned (y>=1). The average grade for each homework in all the chapters need to be found out.

To solve this, write program which has the main process as Director process, which reads a file containing grades of all homeworks of all chapters and creates x number of Manager processes. Each Manager process will take care of solving a chapter. Each manager process will create y number of Worker process and pass marks of n students to each of them and they calculate and print the average.

The input file should contain the data according to the value of x and y and n. For example, the input text file and the process tree for x = 2 and y = 2 and n= 10 will look like the following:


X1Y1
X1Y2
X2Y1
X2Y2
Student1
19
17
20
18
Student2
9
6
10
9
Student3
12
11
10
6
Student4
3
7
9
10
Student5
0
5
8
6
Student6
15
13
15
15
Student7
20
18
18
16
Student8
17
19
19
18
Student9
13
15
14
12
Student10
10
13
18
15
Output:
avg
avg
avg
avg
























Marks: 15
Submission Instructions

    • All the programs MUST be clearly indented and internally documented

    • Make sure your programs compile and run without any errors

• Only include c files or txt files for submission. Do not include any    executables.

    • Save all your programs with meaningful names and zip into a single folder as: Lab4_[your last name here].zip (e.g., Lab4_Xyz.zip)

    • Email your code with the subject line, "Task4-CSC33200–Section 6X(41557)-lastname"

    • Email: sdebnath@ccny.cuny.edu

******


Office Hour: Wednesday 11:00 AM – 12:00 PM
Zoom Link: https://ccny.zoom.us/j/81330004103

Meeting ID: 813 3000 4103
One tap mobile
+16465588656,,81330004103# US (New York)
+13126266799,,81330004103# US (Chicago)

Dial by your location
+1 646 558 8656 US (New York)
+1 312 626 6799 US (Chicago)
+1 301 715 8592 US (Washington DC)
+1 346 248 7799 US (Houston)
+1 669 900 6833 US (San Jose)

+1 253 215 8782 US (Tacoma)
Meeting ID: 813 3000 4103
Find your local number: https://ccny.zoom.us/u/kbw8Ypx156

IMPORTANT NOTE: Please connect with zoom with a valid CCNY or CITYMAIL email id. Please sign up with the CITYMAIL or CCNY email address at :

https://www.ccny.cuny.edu/it/zoom

More products