Download presentation
Presentation is loading. Please wait.
1
Programming project #1 1 CS502 Spring 2006 Programming Project #1 CS-502 Operating Systems Spring 2006
2
Programming project #1 2 CS502 Spring 2006 Programming Assignment 1.Write a command called doit to execute another command and print out statistics 2.Extend doit to become a basic shell that prompts for and executes commands 3.Extend your basic shell to execute commands in the background
3
Programming project #1 3 CS502 Spring 2006 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
4
Programming project #1 4 CS502 Spring 2006 Part 1: doit doit command:– Take another command 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()
5
Programming project #1 5 CS502 Spring 2006 Part 1 (output) % doit cat /etc/motd
6
Programming project #1 6 CS502 Spring 2006 Part 2: a basic shell Repeatedly prompt for command lines Execute each command and print out statistics, as in doit Implement special “built-in” commands exit ch dir Special conditions Exit on end of file Complain about illegal commands Check for line length, number of arguments
7
Programming project #1 7 CS502 Spring 2006 Part 2 output % doit ==>cat /etc/motd ==>cd dir ==>ls ==>exit %
8
Programming project #1 8 CS502 Spring 2006 Part 3: Background execution 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
9
Programming project #1 9 CS502 Spring 2006 Part 3 output % doit ==>numbercrunch & [1] 12345 ==>jobs [1] 12345 numbercrunch ==>ls ==>cat /etc/motd [1] 12345 Completed ==>exit %
10
Programming project #1 10 CS502 Spring 2006 Project submission Due Monday, February 20 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.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.