Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS-3013 & CS-502 Operating Systems Summer 2006

Similar presentations


Presentation on theme: "CS-3013 & CS-502 Operating Systems Summer 2006"— Presentation transcript:

1 CS-3013 & CS-502 Operating Systems Summer 2006
Programming Project #1 CS-3013 & CS-502 Operating Systems Summer 2006 CS 3013 & CS 502 – Summer 2006 Programming Project #1

2 Programming Assignment
Write a command called doit to execute another command and print out statistics Extend doit to become a basic shell that prompts for and executes commands Extend your shell to shell2 to execute commands in the background CS 3013 & CS 502 – Summer 2006 Programming Project #1

3 Purpose To practice using the fork and exec facilities of Unix/Linux
To learn how to find and use on-line documentation about system calls and system facilities. man pages To be accustomed to speaking directly with the operating system CS 3013 & CS 502 – Summer 2006 Programming Project #1

4 Part 1: doit doit command:– Must execute on a CCC or CS Linux system
Take another command line as argument Execute that command Print out statistics about command Must execute on a CCC or CS Linux system May not use system() system call Helpful hints:– fork(), execve(), wait() getrusage(), gettimeofday() CS 3013 & CS 502 – Summer 2006 Programming Project #1

5 Part 1 (output) % doit cat /etc/motd
< print the current message of the day > < statistics about the cat command > CS 3013 & CS 502 – Summer 2006 Programming Project #1

6 Part 2: shell Repeatedly prompt for command lines
Execute each command and print out statistics, as in doit Implement special “built-in” commands exit cd dir Special conditions Exit on end of file Complain about illegal commands Check for line length, number of arguments CS 3013 & CS 502 – Summer 2006 Programming Project #1

7 Part 2 output % shell ==>cat /etc/motd
< print the current message of the day > < statistics about the cat command > ==>cd dir < current directory is changed to dir > ==>ls < listing of files in current directory > < statistics about this ls command > ==>exit % < back to the Unix prompt > CS 3013 & CS 502 – Summer 2006 Programming Project #1

8 Part 3: Background execution (shell2)
Modify shell to support execute commands in background, indicated by ‘&’ character Causes shell to prompt for next command before previous command is complete jobs built-in command lists background tasks in progress Report completion at next opportunity CS 3013 & CS 502 – Summer 2006 Programming Project #1

9 Part 3 output % shell2 ==>numbercrunch &
[1] < indicate background task #1, process id > ==>jobs [1] numbercrunch < print process id and command name for tasks > ==>ls < listing of files in the current directory > < statistics about this ls command > ==>cat /etc/motd [1] Completed < indicate background job done > < statistics about numbercrunch command > < print the current message of the day > < statistics about this cat command > ==>exit % < back to Unix prompt > CS 3013 & CS 502 – Summer 2006 Programming Project #1

10 Project submission Due Monday, June 1 at start of class
Submit via turnin command = ‘/cs/bin/turnin’ on CCC machines classname = ‘cs502’ assignment = ‘project1’ Bring copy of code, test case, and printout to class. Put your name on all files! CS 3013 & CS 502 – Summer 2006 Programming Project #1

11 Term Project Assignment
CS 3013 & CS 502 – Summer 2006 Programming Project #1


Download ppt "CS-3013 & CS-502 Operating Systems Summer 2006"

Similar presentations


Ads by Google