Old Stuff from the OS website

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


Reminder You must work independently on projects. Do not show your code to other students and do not look at other students' code. Do not put your code in a public directory or otherwise make it public. However, you may get all the help you need from the instructors or TAs.

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


Project 1

Project Description

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

mkdir
link
unlink

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.

Class 2 August 29

Here is a link to the two files that I used to demonstrate the Definition Table and the Usage Table in the linker.

Class 3 Sept 2

Here are the two sample programs demonstrating the use of Unix system calls and Win32 APIs.

Unix version of file copy

Win32 version of file copy

Here are the online help pages for some of the system calls disussed in class.

Unix
open
read
write

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.

Class 5 Sept. 9

Here is the sample code using pthreads.

Class 7 Sept. 16

Peterson's algorithm for mutual exclusion

pthreadmutex.c

winmutex.c

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.

Project 3

Here is the spec for the third project

Here is checkresults.c

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

Pthreads
Windows

Exam 2

The second exam will be on Tuesday, Oct 28. It will cover everything discussed in class starting with "Classic synchronization problems" through I/O systems. The reading will include sections 2.4, 2.5, 2.6, Chapters 3, 4, and 5, sections 10.4, 10.5, 11.5 and 11.6.