C Programming Question
Description
Assignment #5 Instructions: Limited Shell
Through this programming assignment, the students will learn to do the following:
Work with processes using fork, pipe, wait, dup2, and the exec system calls.
Additional practice with a Makefile with an all target
- Work with the different address spaces
- The main idea of this assignment is to write a limited function shell that only runs a few programs from a menu.
- Write 4 small programs to start with followed by the menu program called newshell.
1. LETTERS
One program will output the letters in the alphabet to the screen. Make sure they are printed one at a time. They can be printed all on one line. If you already got it working one per line there will not be a deduction.
Usage would be: letters
Output would be:
ABC…
2. numbers
Program 2 would print the numerals 0-9 to the screen. Make sure they are printed one at a time, one per line.
Usage would be: numbers
0
1
2
Etc.
3. FIRSTNAME
Program 3 would print out your first name which is passed in as an argument on the command line in mixed case. This would go to the screen.
Usage would be: firstname yourfirstname
4. USERINPUT
Program 4 will accept alphabetic input from the user via stdin change it to all capital letters and print it to the screen. Do not ask the user to enter the input. Assume the user will know to input alphabetic input.
Usage would be: userinput
5. NEWSHELL
Write a parent program similar to myshell.c but called newshell which will allow the user to choose from a menu of options.
Usage would be: newshell
1 letters
2 numbers
3 firstname
4 userinput
5 letters > filename (letters redirected to a file)
6 letters | userinput (letters piped to userinput)
7 firstname| userinput (names piped to userinput)
8 exit (your program should end by leaving the infinite loop.)
These programs should be completed with the process commands fork, pipe, wait, dup2, and the 6 exec programs. The newshell program should not run any of the other programs, it should fork off children to run the programs.
Do not use any system calls. Make sure you close all file descriptors before the program ends.
Your program will earn points based upon the number of menu items that run properly.
You will need a Makefile with an all target to compile all the programs.
Unformatted Attachment Preview
MPI
Message Passing Model
2
Processes
?Number is specified at start-up time.
?Typically, fixed throughout the execution.
?All execute same program (SPMD).
?Each distinguished by a unique ID number.
?Processes explicitly pass messages to communicate and to synchronize
with each other.
3
Advantages of Message-passing Model
?Gives programmer ability to manage the memory
hierarchy.
?Whatàlocal, whatànot?
?Portability to many architectures: can run both on
shared-memory and distributed-memory
platforms.
?Easier (though not definitely) to create a
deterministic program.
?Non-deterministic programs are very difficult to debug.
4
Circuit Satisfiability
5
check_circuit Code
/* Return 1 if ‘i’th bit of ‘n’ is 1; 0 otherwise */
#define EXTRACT_BIT(n,i) ((n&(1
Purchase answer to see full
attachment
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."