Beruflich Dokumente
Kultur Dokumente
Project #1
Programming Assignment
Write a command called rpcdoit to execute another command remotely and print out statistics
Write a service called doitservice to execute commands requested by rpcdoit Develop an RPC interface between them
CS-4513 D-term 2008 Project #1 2
Background
doit an early project of OS course
Takes command and arguments Forks a child process to execute command Waits for child to terminate Gets statistics about child using getrusage() Prints statistics on stdout
Project #1
This Project
Like doit, but command executes remotely
rpcdoit [-verbose] server command args
This does:
Binds to server Package up command and arguments Makes RPC call to server, waits for results Prints output of command (at least first three lines) Prints statistics
Including round-trip wall clock time, RPC overhead
CS-4513 D-term 2008 Project #1 4
Your task
Design an RPC interface between client and server
.x file suitable for rpcgen
Test
Locally, remotely, concurrently
RPC interface
Defines data types, functions, arguments, result One function doit Arguments
argv, argc
Results
struct containing execution statistics
rpcgen
Takes .x file containing interface definition
Sun XDR format
Generates
.h files needed by client and server
Client and server stubs (Optional) prototypes for client and server programs
doitservice
Start with template (prototype) generated by
rpcgen
rpcdoit
Binds to client with clnt_create() Gets wall-clock time Calls the remote function Receives results Gets wall-clock time again Formats and prints
Output of command (at least three lines) Statistics Round-trip execution time (and difference from remote execution time)
CS-4513 D-term 2008 Project #1 9
Work environment
Please do this work on your virtual machine You may use C or C++ Note:
Your programs will probably be compatible with other Linux systems on campus However, not all C/C++ compilers and Linux kernels are alike Some may produce or ignore various warnings Your virtual machine is the one that counts
CS-4513 D-term 2008 Project #1 10
Testing
Run client and service on same (guest) OS
I.e., specify own IP address as service identity
Testing (continued)
Once it runs on your own virtual machine branch out and run remotely! Options
Two or more virtual machines SSH to Fossil server and run rpcdoit there, specifying your guest OS IP address
CS-4513 D-term 2008 Project #1 12
Project #1
13
Extra Credit
Figure out and implement how to print the full output of remotely executed command with rpcdoit
Prior to printing out statistics
Project #1
14
Class
Collaborative learning about RPC, XDR, rpcgen, etc. Share your questions! Talk to everyone about the concepts Share your knowledge! Use class e-mail list
CS-4513 D-term 2008 Project #1 15
Project submission
Due Friday, March 28, 6:00 PM Submit via web-based Turnin
Project name = Project 1
Project #1
16
One Makefile
make make make make clean all rpcgen doitservice
Project #1
18
Grading
Twenty point project Point allocation
See handout Interface is of grade Concurrent execution of multiple calls is of grade
Extra credit
Five points for printing entire command output.
CS-4513 D-term 2008 Project #1 19
Questions?
Project #1
20