Starting from:

$30

CECS326- Homework 01 Solved

Gantt Charts, Linux systems

A) Purpose: This portion of the assignment familiarizes you with the Linux systems at CSULB and gives you practice with shell scripts.

General warning: you must run this on the linux server linux1.cecs.csulb.edu. Use the ssh (secure shell) command to reach it. If you are working at home, ssh to 134.139.248.2 with port 2022.

There are three parts.

The purpose of the first part is to get some information (your magic numbers) that you need for the paper (Gantt chart) assignment on resource sharing.

The second part has you build and run a shell script that is almost the same as one from lecture. You may find the code from the lectures in the /net/326/ directory (they start with chap01 in their names).

The third part has you design and build a shell script of your own.

1)  Run the program /net/getmagicnumber. This program delivers you 4 magic numbers that you will need for part B of this homework.

2)  Build a shell script from lecture. The name of your script file should be called listdirs. It should start with the foreach example from lecture that lists the lib, bin, and src directories. Since you do not have any such diretories, you will need to modify the script so that the first thing it does is change to the /usr directory (use the cd command). This directory does have the needed three subdirectories.

3)  Build a shell script. The name of your script file should be called getpids.

First, the shell script should get your login name (whoami) It should both save your name into a variable and print the contents of that variable (echo) it to the screen.

Second, the script should list all processes (ps aux), use grep -v to eliminate those processes that have your login name in them, then it should only output the pids of those processes (using cut with the column arguments from lecture).

B) Purpose: This portion of the assignment familiarizes you with Gantt charts and process sharing.

This assignment uses your 4 magic numbers, that means your answer will be different from any one else. Make sure you write your magic numbers at the top of the homework you submit.

To simplify this there are only two things that a process can do, process and wait. Two processes cannot process at the same time so you will need some delays. (IE, assume this is a single core/thread system)

If some of your magic numbers are 0, it’s your lucky day because it’s very easy to do something that takes 0 time; just don’t processs or wait.

There are three processes:

Process 1: processes 3, waits 4, processes 5;

Process 2: processes 2, waits 2, processes 2, waits 3, processes 1;

Process 3: waits (use magic number 1), processes (use magic number 2), waits (use magic number 3), processes (use magic number 4).

Demo: Your shell scripts. The Instructor would also like to read them, so leave them on the server in your home directory. Submit: Your Gantt chart with your magic numbers. They may be handwritten.

Nathan Pickrell                 28 August 2019 (Week 1 Lecture 2)                Due: 4 September 2019 (Week 2, Lecture 2)

More products