$19.99
UNIX up and running
The purpose of this quick assignment is to make sure everyone has access to a UNIX system, preferably Linux. This is a team assignment.
The object is for each student to successfully compile and run the C program forktest.c on a UNIX system and to provide a screenshot of the compilation and execution.
If you already have access to a Linux system (such as on a remote server), then you’re all set to create a screenshot. Otherwise, you may need to install Linux on your laptop or personal computer.
Windows
Students using Windows can install the VirtualBox virtual machine manage (VMM) and install the Debian Linux OS in a virtual machine. You can also use another VMM such as VMWare. Another flavor of Linux (or of UNIX in general) is OK, too, but then you may encounter differences in the API or in the system utilities.
Mac
Students using Mac can also install VirtualBox and Debian like the Windows users. An option is to use the built-in BSD UNIX that’s the foundation for OS X. You’ll need to install the Xcode developer tools, and you may encounter differences from Linux in the API or in the system utilities.
2
What to turn in
This is a team assignment, so each team should collect a screenshot from each team member. Name each screenshot file after your team name followed by the member’s name, such as SuperCoder-Jones.png. In order for the team to get a perfect score, each screenshot must be good, so help each other get Linux up and running!
Each team should attach the screenshots (they can be zipped into a single file). Some mailers may not allow you to mail zip files, so you may have to rename the file to have the suffix other than .zip, such as .zzz. Do not email executable files.
Important: Your subject line should be: CS 149-n Assignment #1, team name where n is the section number (2 or 3) and team name is the name of your team.
Be sure to CC all the members of your team so that when I send you your team score, I can just do a “Reply all”.
3
forktest.c:
#include <stdio.h
main() { printf("Parent: Process started\n"); printf("Parent: Forking a child.\n"); if (fork() != 0) { // Parent int status; printf("Parent: Wait for child to complete.\n"); waitpid(-1, &status, 0); printf("Parent: Terminating.\n"); } else { // Child printf("Child: Process started.\n"); printf("Child: Start 10 second idle:"); int i; for (i = 10; i = 0; i--) { printf("%3d", i); fflush(stdout); sleep(1); } printf(" done!\n"); printf("Child: Terminating.\n"); } }
4
Example screenshot: