Using thr_create() and thr_join()
This example exercises the thr_create() and thr_join() calls. There is not a
parent/child relationship between threads as there is for processes. This can easily be
seen in this example, because threads are created and jo
C Program Structure
A C program basically has the following form:
Function prototypes - declare function types and variables passed to function.
We must have a main() function.
A function has the
We will study this part of the compilation process in greater detail later (Chapter 13.
However we need some basic information for some C programs.
The Preprocessor accepts source code as input and is responsible for
Homework Set #5 (Due Monday, December 15th)
1) Consider the 2D Ising model on a square lattice with nearest- and nextnearest-neighbor interactions, with couplings K and L respectively (see Fig. 1).
a) Carry out a decimation of this system by tracing over
Homework Set #4 (Due Monday, November 24th, in class)
1) Consider the following linear PDE (with a, b constants and n integer),
= a xn .
a) Solve Eq. (1) by the method of characteristics. Express your solution
in terms of the initial cond
Homework Set #3 (Due Wednesday, November 5th, in class)
1) Consider the Rayleigh-Lvy random walk in three dimensions where, starte
ing from a seed particle (whose coordinates are drawn at random), the next
particle is placed at a randomly chosen direction
Homework Set #2 (Due Wednesday, October 15th, in class)
Note: All necessary information for this homework regarding solar system parameters can be found at JPLs website1. In your writeup, you should
include the information you use.
1) In class we derived
Homework Set #1 (Due Monday, September 29th, in class)
1) Dierentiate the functions cos(x) and exp(x) at x = 0.1, 1, 100 using
single precision forward-, central- and extrapolated-dierence algorithms.
a) Write a code that implements the three methods.
Global variables are defined above
in the following
It is also possible to pre-initialise global variables
using the = operator for assignment.
NOTE: The = ope
There are many C compilers around. The cc being the default Sun compiler. The GNU
C compiler gcc is popular and available for many platforms. PC users may also be
familiar with the Borland bcccompiler.
There are also equivalent C+ compilers wh
Characteristics of C
We briefly list some of C's characteristics that define the language and also have lead
to its popularity as a programming language. Naturally we will be studying many of
these aspects throughout the course.
Extensive use o