COP-4338, Programming III Lectures
Note: Links will not be alive until a day or two before class.
- May 9-11: Course Policies; Java Threads Part I
- May 16: Java Memory Model Basics; synchronized
- May 18: More Threading: locks, conditions
- Series of examples using an Account.
Some threads do deposits, some do withdraws on shared account.
The examples extend the Thread class instead of implementing Runnable
and move the printing into the Account class, so you can see
synchronized ordering of output.
- May 23: Multiple locks / deadlock
-
TicketAllocator.java
-
BankDemo1.java: this will deadlock
more than 10% of the time (depending on environment). Lower
the number of accounts to 10 and it almost certainly will deadlock every time.
- May 25: Java 1.5 java.util.Concurrent package(s)
- May 30: No class
- June 1: Java Networking
- June 8, 13, 15, 20: C Programming
- Stale Memory: MemoryDemo.c shows what can
happen if you access a stale pointer.
- Reading Characters at a Time into a String: StringDemo.c
- Using qsort: SortDemo.c
- Suffix Array Demo from class, translated into Java, but using
C-style and no object-oriented constructs:
SuffixArrayDemo.java
- June 22: Exam
- June 27, 29: More C programming -- structs
- July 4: No class
- July 6: Discussion of Assignment #3 and Assignment #4
-
By request, is some hash table code.
This program is similar, but stripped down from the
sketch of Assignment #4 done in class.
It solves the problem of finding the five-character suffixes that appear 500 or more times
in the dictionary file.
It is simplified, from Assignment #4 in that while the hash table uses separate chaining,
there is not also a separate list of words in each hash table node.
But many of the basic ideas are here.
commonsuffix.c`
- July 11: Writing a data structure part 1:
-
hashset.c: implements separate chaining hash tables;
does not yet have code to free the entire table; assumes fixed table
size of 10007. Will improve during next lecture.
- July 13: Writing a data structure part 2:
-
hashset2.c: implements separate
chaining hash tables;
does not leak; includes rehashing; two styles of allocation and
deletion illustrated.
- July 18 and 20: Traversing directories
-
listdir.c: implements a recursive directory listing program
- July 25: Pthreads
- July 27, Aug 1: Sockets