Unix tutorials for newbies
News: Project 1 is due on Tuesday Sept. 16 at 11:59PM.
I have made some small changes to the specification for Project 1
Everyone should make sure that their Solaris accounts are working properly. If you have forgotten your password or never knew it, send email to labstaff@cs.rpi.edu. If you have been issued a new password, it will expire after a few days if you do not change it.
The WebCT site for the course will have a lot of useful information for you; you can submit questions, see the answers to questions from other students, and check your grades. From the WebCT home page click on MY WebCT. Use your RCS login name and password to access the course website.
Here is a link to a brief tutorial on C if you already know C++.
Here is a link to a tutorial on using Microsoft Visual Studio 6.0.
Here is a link to a tutorial on using the Visual Studio debugger; you will be using this a lot, so you should get good at it.
Link to the entire set of Windows APIs
Here are some links to on-line help pages for the WIN32 APIs that you might need for this assignment
CreateDirectory
CopyFile
DeleteFile
GetLastError
The code for GetErrorMessage()
Here are links to some of the Unix man pages that you might want to use for this assignment
Here is a link to general information about Unix system calls, including a complete list of error numbers and a list of system calls.
To submit your project, go to:
https://cgi.cs.rpi.edu/submit/submit.html?course=csci4210 and follow
the instructions.
Here are the online help pages for some of the system calls disussed in class.
Win32
CreateFile
ReadFile
WriteFile
Here is a link to general information about Unix system calls, including a complete list of error numbers and a list of system calls.
Here is the very simple pipe code demo
Here is the code that has one process exec ls and
send the result through a pipe to more
Link to the online help for the entire set of WIN32 synchronization APIs
Project 2
Here is the spec for the second project
Here is the code for replacestring.c. You cannot copy any of this code into your own program.
If you are still hazy on threads, Here is a terrific website on using pthreads
checkresults.c has been updated yet again (8:45AM Thursday) It should run on WIN32 now.
There is a change in the spec for third project (threads and mutexs). For the Unix version, instead of using clock(), use the function:
#include <sys/times.h>
#include <limits.h>
clock_t times(struct tms *buffer);
You need to pass in a pointer to a struct tms,
in order to get this to work properly, but you
do not need to use the argument.
The return value from this function is the number of
clock ticks since some long-ago time. There are
100 clock ticks to the second, so you should call this
function at the start of your program and record the
return value. When you call this function at a later
time, you can determine the elapsed time from the
start of the program by subtracting the value returned
from the first call from the value returned from the
second call, dividing by 100 to get the value in seconds.
A clock_t is a long int. You still have to display elapsed time in seconds, carried to two decimal places (remember to cast the result of the division as a float to avoid truncation).
Here is some sample code to show how to pass structures into a thread and back from a thread